Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bvwells/kubernetes-secrets
Sample application accessing kubernetes secrets
https://github.com/bvwells/kubernetes-secrets
Last synced: 7 days ago
JSON representation
Sample application accessing kubernetes secrets
- Host: GitHub
- URL: https://github.com/bvwells/kubernetes-secrets
- Owner: bvwells
- Created: 2021-12-03T22:28:31.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-13T13:14:34.000Z (over 2 years ago)
- Last Synced: 2024-06-21T08:07:46.187Z (5 months ago)
- Language: Go
- Size: 4.2 MB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:```bash
docker build -t kubernetes-secret .
``````bash
docker tag kubernetes-secret:latest kubernetes-secret:v0.0.1
```## Deploy to Docker kubernetes
Get the Docker desktop context.
```bash
kubectl config get-contexts
kubectl config use-context docker-desktop
```Apply the kubernetes files to the cluster:
```bash
kubectl apply -f kubernetes
```Check that on deployment
```bash
kubectl get deployments -n mynamespace
```Check on the pods
```bash
kubectl get pods -n mynamespace
```Get the logs from the pod
```bash
kubectl logs kubernetes-secrets-xxxxx -n mynamespace
```## Clean up after
To clean up after run:
```bash
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
```