Monday, 16 September 2019

kubernetes secret


https://kubernetes.io/zh/docs/concepts/configuration/secret/

https://kubernetes.io/zh/docs/tasks/inject-data-application/distribute-credentials-secure/

https://kubernetes.io/zh/docs/tasks/inject-data-application/define-environment-variable-container/


delete:
https://stackoverflow.com/questions/45879498/how-can-i-update-a-secret-on-kubernetes-when-it-is-generated-from-a-file
update:

https://gist.github.com/dleske/31691a592917245b9d4d32b61292823b


verify:

to verify you have setup your envs, you have to log into your pod and run commands:


  • get your pods:   kubectl get pods
  • kubectl exec -it yourpodname -- /bin/bash
  • if you got below error :
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/bh\": stat /bin/bh: no such file or directory": unknown
command terminated with exit code 126
  • and if you are using docker openjdk:8-jre-alpine, then just try : 
  • kubectl exec -it yourpodname -- /bin/sh 
  • https://hub.docker.com/_/openjdk     according to this, it has sh not bash.
  • then run : printenv 
  • it will print out all envs

short version:

kubectl exec -it yourpodname -- /bin/sh
printenv

1 comment: