Skip to content

Commit

Permalink
Update kubectl.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lwindolf authored Nov 28, 2023
1 parent a9462f0 commit c560469
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions cheat-sheet/kubernetes/kubectl.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,22 @@ Removing/Readding nodes

## Creating/manipulating resources

Working with file based definitions you can issue the lifecycle commands using the same input file:

kubectl create -f some.json
kubectl delete -f some.json # Useful to delete the same resources with the same YAML!

kubectl edit <type> <resource> # Edit live, will automatically restart stuff
kubectl apply -f some.json
kubectl diff -f some.json
kubectl delete -f some.json

kubectl get rc <node> -o yaml >some.yaml
kubectl update -f some.yaml
Note that you can alway use `--dry-run` to review the effective changes

For existing resources you can use specific commands

kubectl edit <type> <resource> # Edit live, will automatically restart stuff
kubectl delete <type> <resource>

kubectl annotate <type> <name> [--overwrite=true] key=value

kubectl delete pod -l name=<name>
kubectl delete services &lt;service>
kubectl delete deployment &lt;application>

kubectl run-container <name> --image=<image> --port=<port>

kubectl resize --replicas=4 rc <name>
Expand All @@ -69,13 +71,7 @@ Removing/Readding nodes
kubectl set env deployment/<name> <environment variable>=<value>
kubectl set env deployment/<name> --list
kubectl set env pods --all --list

## Testing kubectl Commands

Several commands allow passing "--dry-run" to test impact

kubectl run --dry-run [...]


## Debugging in Pods

Running commands in pods
Expand Down

0 comments on commit c560469

Please sign in to comment.