Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
riyasoni5990 authored Apr 18, 2023
1 parent d3787fd commit 4e7f2d7
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions Secret/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 4e7f2d7

Please sign in to comment.