Azure AKS:分配静态IP后,Kubernetes窗格继续显示CrashLoopBackOff状态

时间:2020-10-04 18:30:53

标签: azure kubernetes kubernetes-pod azure-kubernetes

嗨,我正在遵循以下有关Microsft的指南https://docs.microsoft.com/en-us/azure/aks/static-ip,为我的AKS群集分配静态IP。但是,我面对的是Kubernetes pod在分配静态IP后仍然显示CrashLoopBackOff状态。

这是我创建的静态IP: enter image description here

服务正在按预期运行: enter image description here

错误的屏幕截图: enter image description here

这是打印kubectl describe pod

之后的堆栈跟踪
Name:         dashboardbackend-6d9d56bbfb-l5fbx
Namespace:    default
Priority:     0
Node:         aks-agentpool-40731879-vmss000000/10.240.0.4
Start Time:   Mon, 05 Oct 2020 02:16:25 +0800
Labels:       app=dashboardbackend
              pod-template-hash=6d9d56bbfb
Status:       Running
IP:           10.244.0.15
  IP:           10.244.0.15
Controlled By:  ReplicaSet/dashboardbackend-6d9d56bbfb
Containers:
    Container ID:   docker://83bf57b5f899ba57271b3be85054ea8e03b8e92b6d4dd21cb5623568c73ea030
    Image ID:       docker-pullable://julio02.azurecr.io/dashboardbackend@sha256:2ae7ed770fd890c147710e73245ece19958cbc8e0fcd8d5a3be716ef9c2a35de
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Mon, 05 Oct 2020 02:17:01 +0800
      Finished:     Mon, 05 Oct 2020 02:17:09 +0800
    Ready:          False
    Restart Count:  2
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-lt49b (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-lt49b:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-lt49b
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                From                                        Message
  ----     ------     ----               ----                                        -------
  Normal   Scheduled  65s                default-scheduler                           Successfully assigned default/dashboardbackend-6d9d56bbfb-l5fbx to aks-agentpool-40731879-vmss000000
  Normal   Pulling    29s (x3 over 64s)  kubelet, aks-agentpool-40731879-vmss000000  Pulling image "julio02.azurecr.io/dashboardbackend:55"
  Normal   Pulled     29s (x3 over 63s)  kubelet, aks-agentpool-40731879-vmss000000  Successfully pulled image "julio02.azurecr.io/dashboardbackend:55"
  Normal   Created    29s (x3 over 60s)  kubelet, aks-agentpool-40731879-vmss000000  Created container dashboardbackend
  Normal   Started    29s (x3 over 59s)  kubelet, aks-agentpool-40731879-vmss000000  Started container dashboardbackend
  Warning  BackOff    5s (x3 over 42s)   kubelet, aks-agentpool-40731879-vmss000000  Back-off restarting failed container

1 个答案:

答案 0 :(得分:1)

按照@Vitalli的要求,在遍历所创建的pod的Kubernetes日志后,我已经解决了我的问题。键入kubectl logs [podname]后,我意识到Azure SQL DB的IP地址未添加到连接设置的白名单中。添加并删除pod后,它将重新创建pod,并且应用程序将按预期运行。

enter image description here