mirror of
https://github.com/lemeow125/Notes.git
synced 2025-01-18 10:23:02 +08:00
vault backup: 2024-11-22 00:59:27
Affected files: docs/Command Snippets/Command Snippets.md docs/Command Snippets/Kubernetes Snippets.md
This commit is contained in:
parent
7e72d93cf4
commit
b45c912a82
2 changed files with 54 additions and 1 deletions
|
@ -4,4 +4,5 @@
|
|||
- [Docker - Miscellaneous](Docker%20-%20Miscellaneous.md)
|
||||
- [Docker Run](Docker%20Run.md)
|
||||
- [Windows Snippets](Windows%20Snippets.md)
|
||||
- [Git Snippets](Git%20Snippets.md)
|
||||
- [Git Snippets](Git%20Snippets.md)
|
||||
- [Kubernetes Snippets](Kubernetes%20Snippets.md)
|
52
docs/Command Snippets/Kubernetes Snippets.md
Normal file
52
docs/Command Snippets/Kubernetes Snippets.md
Normal file
|
@ -0,0 +1,52 @@
|
|||
- Get all `pods`
|
||||
```bash
|
||||
kubectl get pods
|
||||
```
|
||||
- Get all `replicacontrollers`
|
||||
```bash
|
||||
kubectl get replicacontrollers
|
||||
```
|
||||
- Get all `replicasets`
|
||||
```bash
|
||||
kubectl get replicasets
|
||||
```
|
||||
- Describe a specific resource (ex. Describe a `deployment` named `myapp-deployment`)
|
||||
```bash
|
||||
kubectl describe deployment/myapp-deployment
|
||||
|
||||
# This works too
|
||||
kubectl describe deployment myapp-deployment
|
||||
```
|
||||
- Get specific resource information in wide format
|
||||
```bash
|
||||
kubectl describe deployment/myapp-deployment -o wide
|
||||
```
|
||||
- Create a `deployment`
|
||||
```bash
|
||||
kubectl create -f deployment.yml
|
||||
```
|
||||
- Update a deployment
|
||||
```bash
|
||||
kubectl apply -f deployment.yml
|
||||
```
|
||||
- Check rollout/deployment history
|
||||
```bash
|
||||
kubectl rollout history deployment/myapp-deployment
|
||||
```
|
||||
- Update a deployment, tracking changes (deprecated)
|
||||
```bash
|
||||
kubectl apply -f deployment.yml --record
|
||||
```
|
||||
- Update a deployment using `annotate`
|
||||
**Note**
|
||||
Changes to `scale` will not create a new `deployment`. Annotating after this may result in the message for the previous `deployment` being replaced
|
||||
```bash
|
||||
# This assumes you've annotated the previous deployment already
|
||||
kubectl apply -f deployment.yml
|
||||
|
||||
# Annotate the new deployment
|
||||
kubectl annotate deployment/myapp-deployment kubernetes.io/change-cause="DESCRIBE_CHANGES_HERE"
|
||||
|
||||
# You can then view the rollout history
|
||||
kubectl rollout history deployment/myapp-deployment
|
||||
```
|
Loading…
Reference in a new issue