服务没有负载均衡器入口 IP - Devops

Service does not have load balancer ingress IP - Devops

我的 helm 图表中有一个部署配置,

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ template "userapi.fullname" . }}
  labels:
    app: {{ template "userapi.name" . }}
    chart: {{ template "userapi.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app: {{ template "userapi.name" . }}
      release: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ template "userapi.name" . }}
        release: {{ .Release.Name }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: {{ .Values.service.port }}
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
            initialDelaySeconds: 30
          readinessProbe:
            httpGet:
              path: /
              port: http
            initialDelaySeconds: 30

此外,我已经配置了我的集群,基本上这是我的配置:

az group create --name demorg --location eastus

    az aks create \
    --resource-group demorg \
    --name democluster \
    --node-count 1 \
    --vm-set-type VirtualMachineScaleSets \
    --load-balancer-sku standard \
    --enable-cluster-autoscaler \
    --min-count 1 \
    --max-count 3
    
    az acr create --resource-group demorg --name acrdemo --sku Standard

但是我收到这个错误:

history.go:53: [debug] getting history for release userapi 2021-04-19T07:24:14.7353557Z Release "userapi" does not exist. Installing it now. 2021-04-19T07:24:14.7354630Z install.go:172: [debug] Original chart version: "" 2021-04-19T07:24:14.7357809Z install.go:189: [debug] CHART PATH: /home/vsts/work/r1/a/_userapi-CI/dropuser/userapi-v0.4.0.tgz 2021-04-19T07:24:14.7360391Z 2021-04-19T07:24:14.7397152Z client.go:109: [debug] creating 2 resource(s) 2021-04-19T07:24:14.7397607Z wait.go:53: [debug] beginning wait for 2 resources with timeout of 2m0s 2021-04-19T07:24:14.7398121Z wait.go:206: [debug] Service does not have load balancer ingress IP address: demospace/userapi 2021-04-19T07:24:14.7398987Z wait.go:225: [debug] Deployment is not ready: demospace/userapi. 0 out of 2 expected pods are ready 2021-04-19T07:24:14.7441027Z Error: timed out waiting for the condition 2021-04-19T07:24:14.7441419Z helm.go:81: [debug] timed out waiting for the condition 2021-04-19T07:24:14.7468168Z ##[error]history.go:53: [debug] getting history for release userapi

我该如何解决?我尝试了几种方法,但没有找到解决方案

[debug] Deployment is not ready: demospace/userapi. 0 out of 2 expected pods are ready

检查您的应用有什么问题,例如检查应用程序日志。

例如首先列出你的pods:

kubectl get pods

然后你得到你pods的名字。现在您想要查看应用程序日志,并且希望您正在记录应用程序未就绪的原因(例如,响应路径 / 上的 ReadinessProbe)。检查日志:

kubectl logs <pod-name>