Kubernetes Secret are used to store secrets during the setup of the cluster and then we can mount the same inside the docker containers. In this example, I am using it to store the Oracle ATP wallet which is used to talk to the ATP instance
This is using the command line, apart from that even we can have a Secret Kind file similar to Deployment Kind and set it up using the 'kubectl apply'.
After this, we need to mount the secret as a volume and use it inside the container
Other links:
http://venkateshbook.blogspot.com/2019/05/kubernetes-commands.html
http://venkateshbook.blogspot.com/2019/05/kubernetes-yaml-definitions.html
http://venkateshbook.blogspot.com/2019/05/02-kubernetes-service-definition.html
kubectl create secret generic db-user-pass
--from-file=./cwallet.sso
--from-file=./ewallet.p12
--from-file=./keystore.jks
--from-file=./ojdbc.properties
--from-file=./sqlnet.ora
--from-file=./tnsnames.ora
--from-file=./truststore.jks
This is using the command line, apart from that even we can have a Secret Kind file similar to Deployment Kind and set it up using the 'kubectl apply'.
After this, we need to mount the secret as a volume and use it inside the container
apiVersion: v1
kind: Deployment
metadata:
name: addition-svc-deployment
labels:
name: addition-svc
spec:
volumes:
- name: secret-volume
secret:
secretName: db-user-pass
containers:
- name: addition-svc-container
image: addition-svc:latest
volumeMounts:
- name: secret-volume
readOnly: true
mountPath: "/etc/secret/atp-wallet"
Other links:
http://venkateshbook.blogspot.com/2019/05/kubernetes-commands.html
http://venkateshbook.blogspot.com/2019/05/kubernetes-yaml-definitions.html
http://venkateshbook.blogspot.com/2019/05/02-kubernetes-service-definition.html