banzaicloud/koperator

Vault-agent not shutting down after main container finished execution

aksathar opened this issue · 1 comments

I am trying to run a data migration job before deploying my main service. To achieve this, I've written a new 'job.yaml' using "helm.sh/hook": pre-instal.which contains vault-agent as one container.

After deployment, from the logs of container it is clear that all migration code executed successfully.

Even though the migration container completes successfully, the pre-install Job itself fails to succeed because the vault-agent is still in running state.
Can some one please help on this?

Pod Status:

kubectl describe qdm-migration-service-job-s9qvs -n qdm
Name:             qdm-migration-service-job-s9qvs
Namespace:        qdm
.......
Status:           Running
Controlled By:  Job/qdm-migration-service-job
Init Containers:
  copy-vault-env:
    .......
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Thu, 20 Jul 2023 10:40:35 +0530
      Finished:     Thu, 20 Jul 2023 10:40:35 +0530
    Ready:          True
    Restart Count:  0
..........
Containers:
  vault-agent:
    Container ID:  cri-o://f703a9c050a5b391fbe1c.....
    Image:         docker.*******.com/qdm-images/qdm-vault:1.8.0
    Image ID:      ****
    Port:          <none>
    Host Port:     <none>
    State:          Running
      Started:      Thu, 20 Jul 2023 10:40:36 +0530
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     100m
      memory:  128Mi
    Requests:
      cpu:     100m
      memory:  128Mi
    Environment:
      VAULT_ADDR:         https://vault.******:8200
      VAULT_SKIP_VERIFY:  true
  qdm-migration-service:
    Container ID:  cri-o://f47d3aedc4ed6902da4459***
    Image:         ****
    Image ID:      ****
    Port:          8092/TCP
    Host Port:     0/TCP
    Command:
      /vault/vault-env
    State:          Terminated
      Reason:       Completed
      Message:      Job completed successfully!
      Exit Code:    0
      Started:      Thu, 20 Jul 2023 10:40:47 +0530
      Finished:     Thu, 20 Jul 2023 10:44:17 +0530
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     2
      memory:  5Gi
    Requests:
      cpu:     2
      memory:  4Gi
    Environment:
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dbtsv (ro)
      /vault/ from vault-env (rw)
      /vault/secrets from agent-secrets (rw)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  .....
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  23m   default-scheduler  Successfully assigned qdm/qdm-migration-service-job-s9qvs to 10.1.7.123
  Normal  Pulled     23m   kubelet            Container image "*****" already present on machine
  Normal  Created    23m   kubelet            Created container copy-vault-env
  Normal  Started    23m   kubelet            Started container copy-vault-env
  Normal  Pulled     23m   kubelet            Container image "d*******" already present on machine
  Normal  Created    23m   kubelet            Created container vault-agent
  Normal  Started    23m   kubelet            Started container vault-agent
  Normal  Pulling    23m   kubelet            Pulling image "****qdm-pdb-migration-service:5.0"
  Normal  Pulled     23m   kubelet            Successfully pulled image "****qdm-pdb-migration-service:5.0" in 10.9s
  Normal  Created    23m   kubelet            Created container qdm-pdb-migration-service
  Normal  Started    23m   kubelet            Started container qdm-pdb-migration-service

Hello @aksathar!

Are you sure about that you wanted to write this issue here?
If yes please give us more context.
Koperator is a kuberetens operator to manage Kafka cluster.