Skip to content

bvwells/kubernetes-secrets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes secrets API example

This git repo illustrates a small application which can access kubernetes secrets.

Build small application

To test the application build the docker image which builds the small application. Run the command:

docker build -t kubernetes-secret .
docker tag kubernetes-secret:latest kubernetes-secret:v0.0.1

Deploy to Docker kubernetes

Get the Docker desktop context.

kubectl config get-contexts
kubectl config use-context docker-desktop

Apply the kubernetes files to the cluster:

kubectl apply -f kubernetes

Check that on deployment

kubectl get deployments -n mynamespace

Check on the pods

kubectl get pods -n mynamespace

Get the logs from the pod

kubectl logs kubernetes-secrets-xxxxx  -n mynamespace

Clean up after

To clean up after run:

kubectl delete secret mysecret -n mynamespace
kubectl delete deployment kubernetes-secrets -n mynamespace
kubectl delete role secret-reader -n mynamespace
kubectl delete rolebinding read-secrets -n mynamespace
kubectl delete serviceaccount my-service-account -n mynamespace

About

Sample application accessing kubernetes secrets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published