Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS EKS Kubernetes and DockerHub

I have a cluster and node creates in 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

However, I did a mistake in deployment.yaml and I need to re-apply it to the configuration

My question is:

1 - How do I reapply a deployment.yaml to the AWS EKS cluster using kubectl? Just running the above command is not working (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)

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

like image 650
MasterOfTheHouse Avatar asked Dec 31 '22 23:12

MasterOfTheHouse


1 Answers

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. Usually you don't do drop/create on prod. that is why i am using image change all the time. just have to change tag on every new image.

like image 190
user2932688 Avatar answered Jan 04 '23 00:01

user2932688