Conjur - secrets-provider-for-k8s - Application POD not re-starting/recreating after secret are updated
Symptom
Application POD will not restart/recreate after secret are updated on the Conjur side, the Secrets Provider for K8 POD will recreate.
Environment
13.0;13.2;13.1;13.3;13.4;13.5 Conjur Client Libraries
Kubernetes Secrets mode
Cause
Possible cause is due to the wrong setting of "livenessProbe" & "lifecycle" and Incorrect permissions on application POD and the secrets provider POD being run as different users, which is not allowing the application pod's liveness probe to properly read and delete the sentinel files.
For the permission issue, the error below can be seen in the describe POD events:
Warning Unhealthy 47s kubelet Liveness probe failed: rm: cannot remove './CONJUR_SECRETS_UPDATED': No such file or directory
Resolution
- To fix the permission issue:
Add the following "securityContext" to both the application POD and the secrets provider POD in the deployment file:
securityContext:
runAsUser: 9999
This can be any ID but ensure that its the same for both POD's.
Example:
- name: application
image:
application:latest
imagePullPolicy: Always
securityContext:
runAsUser: 9999
- image:
secrets-provider-for-k8s:latest
imagePullPolicy: Always
name:
cyberark-secrets-provider-for-k8s
securityContext:
runAsUser: 9999
volumeMounts:
- Correcting the deployment setup:
- Ensure the Lifecycle and Liveness probe are setup as per documentation.
- Only add liveness probe on the application POD as It only needs to be on the application POD not on the secrets provider POD.
Note: Any changes to deployment file will require redeploying of the POD's for the changes to implement.