TKC upgrade completes successful but application pods are not running.
Login to the control plane of the affected TKC and run "kubectl get pods -n <application namespace>"
Example:
Application XYZ installed in namespace xyz
root@xxxxxxxxxxxxxx [ ~ ]# kubectl get pods -n xyz
Note: no pods are running
root@xxxxxxxxxxxxxx [ ~ ]# kubectl get nsNAME STATUS AGEdefault Active 374dkube-node-lease Active 374dkube-public Active 374dkube-system Active 374dxyz Active 374dvelero Active 363dvmware-system-auth Active 374dvmware-system-cloud-provider Active 374dvmware-system-csi Active 374droot@xxxxxxxxxxxxxx [ ~ ]#
root@xxxxxxxxxxxxxx [ ~ ]# kubectl get all -n xyzNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEservice/xyz ClusterIP None <none> 3306/TCP 374dservice/xyz LoadBalancer xxxxxxxxxxxxxx xxxxxxxxxxxxxx 80:32296/TCP,443:30935/TCP,18443:30971/TCP 374d
NAME READY UP-TO-DATE AVAILABLE AGEdeployment.apps/xyz 0/1 0 0 374ddeployment.apps/xyz 0/1 0 0 374d
NAME DESIRED CURRENT READY AGEreplicaset.apps/-5bf4599d9b 1 0 0 374dxyzreplicaset.apps/xyz-5c98c5886c 1 0 0 374dreplicaset.apps/xyz-f876d69fc 0 0 0 374droot@xxxxxxxxxxxxxx [ ~ ]#
root@ [ ~ ]# kubectl describe replicaset.apps/xxxxxxxxxxxxxx-5bf4599d9b -n xyzxyzName: -5bf4599d9bxyzNamespace: xyzSelector: app=,pod-template-hash=5bf4599d9b,tier=mariadbxyzLabels: app=xyz pod-template-hash=5bf4599d9b tier=mariadbAnnotations: deployment.kubernetes.io/desired-replicas: 1 deployment.kubernetes.io/max-replicas: 1 deployment.kubernetes.io/revision: 1Controlled By: Deployment/xyzReplicas: 0 current / 1 desiredPods Status: 0 Running / 0 Waiting / 0 Succeeded / 0 FailedPod Template: Labels: app=xyz pod-template-hash=5bf4599d9b tier=mariadb Containers: -db:xyz Image: mariadb:10.4 Port: 3306/TCP Host Port: 0/TCP Environment: MYSQL_ROOT_PASSWORD: <set to the key 'password' in secret '-xxxxxx'> Optional: falsexyz MYSQL_DATABASE: xyz MYSQL_USER: xyz MYSQL_PASSWORD: <set to the key 'password' in secret '-xxxx'> Optional: falsexyz TZ: Europe/Berlin Mounts: /var/lib/mysql from db-persistent-storage (rw) Volumes: db-persistent-storage: Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) ClaimName: db-files ReadOnly: falseConditions: Type Status Reason ---- ------ ------ ReplicaFailure True FailedCreateEvents: Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedCreate 67m replicaset-controller Error creating: pods "-5bf4599d9b-qrxcc" is forbidden: violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "xyz-db" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "xyz-db" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "xyz-db" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "xyz-db" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")xyz
Application namespace does not have any pod security labels
root@ [ ~ ]# kubectl get ns xyz -o yamlxxxxxxxxxxxxxxapiVersion: v1kind: Namespacemetadata: creationTimestamp: "2024-01-11T14:17:21Z" labels: kubernetes.io/metadata.name: xyz name: xyz resourceVersion: "90233872" uid: xxxxxxxspec: finalizers: - kubernetesstatus: phase: Active
Add the following labels for the pod-security to the affected namespace:
pod-security.kubernetes.io/audit: privilegedpod-security.kubernetes.io/audit-version: latestpod-security.kubernetes.io/enforce: privilegedpod-security.kubernetes.io/enforce-version: latestpod-security.kubernetes.io/warn: privilegedpod-security.kubernetes.io/warn-version: latest
kubectl edit ns <affected namespace>
root@ [ ~ ]# kubectl get ns xyz -o yamlxxxxxxxxxxxxxxapiVersion: v1kind: Namespacemetadata: creationTimestamp: "2024-01-11T14:17:21Z" labels: kubernetes.io/metadata.name: xyz pod-security.kubernetes.io/audit: privileged pod-security.kubernetes.io/audit-version: latest pod-security.kubernetes.io/enforce: privileged pod-security.kubernetes.io/enforce-version: latest pod-security.kubernetes.io/warn: privileged pod-security.kubernetes.io/warn-version: latest name: xyz resourceVersion: "90233872" uid: xxxxxxxspec: finalizers: - kubernetesstatus: phase: Active
root@xxxxxxxxxxxxxx [ ~ ]# kubectl describe rs -5bf4599d9b -n xyzxyzName: -5bf4599d9bxyzNamespace: xyzSelector: app=,pod-template-hash=xyzxxxxxxx,tier=mariadbLabels: app=xyz pod-template-hash=5bf4599d9b tier=mariadbAnnotations: deployment.kubernetes.io/desired-replicas: 1 deployment.kubernetes.io/max-replicas: 1 deployment.kubernetes.io/revision: 1Controlled By: Deployment/xyzReplicas: 1 current / 1 desiredPods Status: 1 Running / 0 Waiting / 0 Succeeded / 0 FailedPod Template: Labels: app=xyz pod-template-hash=5bf4599d9b tier=mariadb Containers: -db:xyz Image: mariadb:10.4 Port: 3306/TCP Host Port: 0/TCP Environment: MYSQL_ROOT_PASSWORD: <set to the key 'password' in secret '-xxxxxxx'> Optional: falsexyz MYSQL_DATABASE: xyz MYSQL_USER: xyz MYSQL_PASSWORD: <set to the key 'password' in secret '-xyzxxxxxxx'> Optional: false TZ: Europe/Berlin Mounts: /var/lib/mysql from db-persistent-storage (rw) Volumes: db-persistent-storage: Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) ClaimName: db-files ReadOnly: falseEvents: Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedCreate 17m replicaset-controller Error creating: pods "-5bf4599d9b-rxwhl" is forbidden: violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "xyz-db" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "xyz-db" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "xyz-db" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "xyz-db" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")xyz Normal SuccessfulCreate 79s replicaset-controller Created pod: -5bf4599d9b-jnh4gxyz
Expected result: Application pods should come up now
root@xxxxxxxxxxxxxxxxxx [ ~ ]# kubectl get pods -n xyzNAME READY STATUS RESTARTS AGE-5bf4599d9b-jnh4g 1/1 Running 0 85sxyz-5c98c5886c-l22jg 1/1 Running 0 85sxyz