kubernetes 未创建Kuberentes部署Pod

n3h0vuf2  于 2023-06-21  发布在  Kubernetes
关注(0)|答案(1)|浏览(118)

我的spring部署在kubernetes上使用docker桌面它工作正常它的规模向上和向下突然部署卡在0/1与0 availebal pod
kubectl describe replicaset consumer-deployment-8487d9fdf6^C显示

Service Account:  spring-boot
  Containers:
   consumer-container:
    Image:      myrepo/repo:tagname
    Port:       8087/TCP
    Host Port:  0/TCP
    Requests:
      cpu:     500m
      memory:  512Mi
    Environment:
      SPRING_RABBITMQ_HOST:          172.17.0.2
      SPRING_RABBITMQ_USERNAME:      guest
      SPRING_RABBITMQ_PASSWORD:      guest
      SPRING_RABBITMQ_VIRTUAL_HOST:  /
    Mounts:                          <none>
  Volumes:                           <none>
Conditions:
  Type             Status  Reason
  ----             ------  ------
  ReplicaFailure   True    FailedCreate
Events:
  Type     Reason        Age                 From                   Message
  ----     ------        ----                ----                   -------
  Warning  FailedCreate  94s (x18 over 12m)  replicaset-controller  Error creating: pods "consumer-deployment-8487d9fdf6-" is forbidden: error looking up service account default/spring-boot: serviceaccount "spring-boot" not found

Kubectl describe nodes显示了这一点

Normal   NodeHasNoDiskPressure    44m (x8 over 44m)    kubelet          Node docker-desktop status is now: NodeHasNoDiskPressure
  Normal   NodeHasSufficientMemory  44m (x8 over 44m)    kubelet          Node docker-desktop status is now: NodeHasSufficientMemory
  Normal   RegisteredNode           43m                  node-controller  Node docker-desktop event: Registered Node docker-desktop in Controller
  Normal   Starting                 34m                  kubelet          Starting kubelet.
  Normal   NodeAllocatableEnforced  34m                  kubelet          Updated Node Allocatable limit across pods
  Normal   NodeHasSufficientMemory  34m (x8 over 34m)    kubelet          Node docker-desktop status is now: NodeHasSufficientMemory
  Normal   NodeHasNoDiskPressure    34m (x8 over 34m)    kubelet          Node docker-desktop status is now: NodeHasNoDiskPressure
  Normal   NodeHasSufficientPID     34m (x7 over 34m)    kubelet          Node docker-desktop status is now: NodeHasSufficientPID
  Normal   RegisteredNode           33m                  node-controller  Node docker-desktop event: Registered Node docker-desktop in Controller

我尝试修剪命令,它删除约6 GB,但问题仍然存在

docker system prune

k描述部署给出了

kubectl describe deployment/consumer-deployment
Name:                   consumer-deployment
Namespace:              default
CreationTimestamp:      Mon, 12 Jun 2023 11:08:13 +0100
Labels:                 app=consumer-app
Annotations:            deployment.kubernetes.io/revision: 1
Selector:               app=consumer-app
Replicas:               1 desired | 0 updated | 0 total | 0 available | 1 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:           app=consumer-app
  Service Account:  spring-boot
  Containers:
   consumer-container:
    Image:      repo/myrepo:tagname
    Port:       8087/TCP
    Host Port:  0/TCP
    Requests:
      cpu:     500m
      memory:  512Mi
    Environment:
      SPRING_RABBITMQ_HOST:          172.17.0.2
      SPRING_RABBITMQ_USERNAME:      guest
      SPRING_RABBITMQ_PASSWORD:      guest
      SPRING_RABBITMQ_VIRTUAL_HOST:  /
    Mounts:                          <none>
  Volumes:                           <none>
Conditions:
  Type             Status  Reason
  ----             ------  ------
  Progressing      True    NewReplicaSetCreated
  Available        False   MinimumReplicasUnavailable
  ReplicaFailure   True    FailedCreate
OldReplicaSets:    <none>
NewReplicaSet:     consumer-deployment-8487d9fdf6 (0/1 replicas created)
Events:
  Type    Reason             Age    From                   Message
  ----    ------             ----   ----                   -------
  Normal  ScalingReplicaSet  9m38s  deployment-controller  Scaled up replica set consumer-deployment-8487d9fdf6 to 1

还有什么我需要调查的吗??

new9mtju

new9mtju1#

错误出现在您提供的附加输出中

Warning  FailedCreate  94s (x18 over 12m)  replicaset-controller  Error creating: pods "consumer-deployment-8487d9fdf6-" is forbidden: error looking up service account default/spring-boot: serviceaccount "spring-boot" not found

您正在尝试使用服务帐户创建部署,而该帐户可能不存在。

相关问题