-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3787fd
commit 4e7f2d7
Showing
1 changed file
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,34 +11,54 @@ kubectl create secret generic db-secret --from-literal=username=dbuser --from-li | |
``` | ||
|
||
#### Docker-registry Secret | ||
```kubectl create secret docker-registry docker-secret [email protected] --docker-username=dev --docker-password=pass1234 --docker-server=my-registry.example:5000``` | ||
``` | ||
kubectl create secret docker-registry docker-secret [email protected] --docker-username=dev --docker-password=pass1234 --docker-server=my-registry.example:5000 | ||
``` | ||
|
||
#### TLS Secret | ||
```kubectl create secret tls my-tls-secret --cert=/root/data/serverca.crt --key=/root/data/servercakey.pem``` | ||
``` | ||
kubectl create secret tls my-tls-secret --cert=/root/data/serverca.crt --key=/root/data/servercakey.pem | ||
``` | ||
|
||
### To apply yaml files | ||
```kubectl apply -f <file-name.yaml>``` | ||
``` | ||
kubectl apply -f <file-name.yaml> | ||
``` | ||
|
||
### To check running pods | ||
```kubectl get pods``` | ||
``` | ||
kubectl get pods | ||
``` | ||
|
||
### To check created secrets | ||
```kubectl get secret``` | ||
``` | ||
kubectl get secret | ||
``` | ||
|
||
### To describe a secret | ||
```kubectl describe secret <secret-name>``` | ||
``` | ||
kubectl describe secret <secret-name> | ||
``` | ||
|
||
### To check environment variables in running pod | ||
```kubectl exec -it <pod-name> -- printenv``` | ||
``` | ||
kubectl exec -it <pod-name> -- printenv | ||
``` | ||
|
||
### To go inside running pod | ||
```kubectl exec -it <pod-name> -- bash``` | ||
``` | ||
kubectl exec -it <pod-name> -- bash | ||
``` | ||
|
||
### To extract pod's yaml file | ||
```kubectl get pod <pod-name> -o yaml``` | ||
``` | ||
kubectl get pod <pod-name> -o yaml | ||
``` | ||
|
||
### To decode the encrypted data | ||
```echo "<data>" | base64 -d``` | ||
``` | ||
echo "<data>" | base64 -d | ||
``` | ||
|
||
## Conclusion | ||
Kubernetes secrets are an important aspect of managing Kubernetes applications. They allow you to store sensitive data securely and manage access to that data. By using the commands and code samples in this repository, you'll be able to easily create, use, and manage secrets in your Kubernetes applications. |