kubectl describe pod <pod_name>
kubectl get pods
command to list all the pods in the cluster.kubectl get pod <pod-name> -o yaml > pod.yaml
command to export the pod’s manifest file to a YAML file.pod.yaml
file in a text editor.securityContext
section under the spec
section of the YAML file.securityContext
section to include the runAsNonRoot: true
and runAsUser: <non-root-user-id>
fields. This will ensure that the pod runs as a non-root user.pod.yaml
file.kubectl apply -f pod.yaml
command to apply the updated manifest file and make the necessary changes to the pod.kubectl get pod <pod-name>
command and checking the pod’s status.<pod-name>
with the actual name of the affected pod, and <non-root-user-id>
with the desired non-root user ID to be used by the pod.