Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update kubernetes secrets doesn't update running container env vars

Tags:

Currenly when updating a kubernetes secrets file, in order to apply the changes, I need to run kubectl apply -f my-secrets.yaml. If there was a running container, it would still be using the old secrets. In order to apply the new secrets on the running container, I currently run the command kubectl replace -f my-pod.yaml . I was wondering if this is the best way to update a running container secret, or am I missing something.

Thanks.

like image 767
OmriToptix Avatar asked Jun 21 '16 13:06

OmriToptix


People also ask

How do I change the secret value in Kubernetes?

kubectl edit secret <my secret> will (in my case) invoke vi. Now I move the cursor to the space after the colon of the secret I want to edit. Then I press r and [enter] which will put the base64 encoded value onto a line of its own.

Can you pass ConfigMaps as environmental variables?

A ConfigMap is an API object used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume.


1 Answers

For k8s' versions >v1.15: kubectl rollout restart deployment $deploymentname: this will restart pods incrementally without causing downtime.

like image 69
victortv Avatar answered Sep 19 '22 15:09

victortv