简体   繁体   English

AWS EKS Kubernetes 和 DockerHub

[英]AWS EKS Kubernetes and DockerHub

I have a cluster and node creates in AWS EKS.我在 AWS EKS 中创建了一个集群和节点。 I applied the deployment to that cluster as under我将部署应用到该集群,如下所示

kubectl apply -f deployment.yaml

Where deployment.yaml contains the containers' specification along with DockerHub repo and image其中 deployment.yaml 包含容器的规范以及 DockerHub 存储库和图像

However, I did a mistake in deployment.yaml and I need to re-apply it to the configuration但是,我在部署中犯了一个错误。yaml 我需要将其重新应用于配置

My question is:我的问题是:

1 - How do I reapply a deployment.yaml to the AWS EKS cluster using kubectl? 1 - 如何使用 kubectl 将 deployment.yaml 重新应用到 AWS EKS 集群? Just running the above command is not working ( kubectl apply -f deployment.yaml )仅运行上述命令不起作用( kubectl apply -f deployment.yaml

2- After I re-apply the deployment.yaml, will the node will go an pick up the DockerHub image or do I still need to do something else( supposing all the other details are ok) 2-在我重新应用部署后。yaml,节点将 go 拿起 DockerHub 图像还是我还需要做其他事情(假设所有其他细节都可以)

Some outputs below:下面的一些输出:

>> kubectl get pods

my-app-786dc95d8f-b6w4h   0/1     ImagePullBackOff   0          9h
my-app-786dc95d8f-w8hkg   0/1     ImagePullBackOff   0          9h
kubectl describe pod my-app-786dc95d8f-b6w4h                                                                            
Name:         my-app-786dc95d8f-b6w4h
Namespace:    default
Priority:     0
Node:         ip-192-168-24-13.ec2.internal/192.168.24.13
Start Time:   Fri, 10 Jul 2020 12:54:38 -0400
Labels:       app=my-app
              pod-template-hash=786dc95d8f
Annotations:  kubernetes.io/psp: eks.privileged
Status:       Pending
IP:           192.168.7.235
IPs:
  IP:           192.168.7.235
Controlled By:  ReplicaSet/my-app-786dc95d8f
Containers:
  simple-node:
    Container ID:
    Image:          BAD_REPO/simple-node
    Image ID:
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-mwwvl (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-mwwvl:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-mwwvl
    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   BackOff  17m (x2570 over 9h)    kubelet, ip-192-168-24-13.ec2.internal  Back-off pulling image "BAD_REPO/simple-node"
  Warning  Failed   2m48s (x2634 over 9h)  kubelet, ip-192-168-24-13.ec2.internal  Error: ImagePullBackOff

BR BR

if you need to change image:如果您需要更改图像:

kubectl set image deployment.v1.apps/{your_deployment_name} image_name:tag

but you always can do但你总能做到

kubectl delete -f deployment.yaml
kubectl create -f deployment.yaml

since your image is in ImagePullBackOff - it doesn't work anyway and you can just recreate deployment.因为你的图像在ImagePullBackOff - 它无论如何都不起作用,你可以重新创建部署。 Usually you don't do drop/create on prod.通常你不会在 prod 上做 drop/create。 that is why i am using image change all the time.这就是为什么我一直在使用图像更改。 just have to change tag on every new image.只需要在每个新图像上更改标签。

ImagePullBackOff means that kubernetes is not able to pull the image. ImagePullBackOff表示 kubernetes 无法拉取图像。

Specially, the service account "default" is not able to pull the image.特别是,服务帐户“默认”无法提取图像。

To fix this issue, you need two checks:要解决此问题,您需要进行两项检查:

  • Check that you don't have typo in the image name and tag.检查图像名称和标签中是否有拼写错误。 And that image is available publically.并且该图像是公开的。
  • If the Docker registry is private, make sure to create secret with dockerlogin type, and then patch the service account "default" by this secret.如果 Docker 注册表是私有的,请确保创建 dockerlogin 类型的密码,然后使用此密码修补服务帐户“默认”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM