0
votes

EKS cluster version:

Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.1", GitCommit:"c4d752765b3bbac2237bf87cf0b1c2e307844666", GitTreeState:"clean", BuildDate:"2020-12-19T11:45:27Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.9-eks-d1db3c", GitCommit:"d1db3c46e55f95d6a7d3e5578689371318f95ff9", GitTreeState:"clean", BuildDate:"2020-10-20T22:18:07Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

Given below is my deployment file :

kind: Deployment
apiVersion: apps/v1
metadata:
  name: sample-pod
  namespace: front-end
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sample-pod
  template:
    metadata:
      labels:
        app: sample-pod
    spec:
      serviceAccountName: my-service-account
      containers:
        - name: sample-pod
          image: <Account-id>.dkr.ecr.us-east-1.amazonaws.com/sample-pod-image:latest
          resources:
            limits:
              cpu: 1000m
              memory: 1000Mi
            requests:
              cpu: 500m
              memory: 500Mi
          env:
            - name: name
              value: sample-pod
            - name: ACTIVE_SPRING_PROFILE
              value: dev
          imagePullPolicy: Always
          ports:
            - name: http
              containerPort: 8091
      imagePullSecrets:
        - name: <my_region>-1-ecr-registry

And this is my docker file.

FROM  amazoncorretto:latest
COPY bootstarp.sh /bootstarp.sh
RUN yum -y install aws-cli 
CMD ["tail", "-f" , "/bootstarp.sh"]

Steps to reproduce:

  1. kubectl apply -f my-dep.yaml
  2. Let container be create.
  3. Delete deployment using command kubectl delete -f my-dep.yaml
  4. Recreate using command apply -f my-dep.yaml
1
did you try given solutions here? stackoverflow.com/questions/44305615/…Sachith Muhandiram
Did found something. Edited the issue: github.com/aws/amazon-vpc-cni-k8s/issues/59Amit Meena
Thanks, @SachithMuhandiram I am using EKS managed cluster on AWS the k8 version I am using is 1.18 and the post is for an earlier version.Amit Meena

1 Answers

0
votes

Not a perfect soln but this is how i overcame it.

Root cause: The deployment was in the terminating stage and I was recreating the deployment which involves the reassignment of networking resources and due to deadlock the deployment fails.

Soln: I have added a cool dow period in between the termination and recreation of the deployment. Earlier I was deleting and recreating the deployment in one shot (using a shell script).

Earlier :

kubectl delete-f my-dep.yaml
some more instructions .....
kubectl apply -f my-dep.yaml

Now:

kubectl delete-f my-dep.yaml
some more instructions .....
**sleep 1m 30s**
kubectl apply -f my-dep.yaml

Because of the cool down, I can now predictably deploy the container.

Regards Amit Meena