Learn kubectl FAST | Only 07:23 | MOST USED KUBECTL COMMANDS

preview_player
Показать описание


#Get all contexts
kubectl config get-contexts

#Select a context to use
kubectl config use-context rancher-desktop

#Get all namespaces
kubectl get namespaces
kubectl get ns

#Create a deployment in the default namespace
kubectl create deployment nginx-manual --image=nginx

#See deployment in default namespace
kubectl get deploy

#Delete deployment in default namespace
kubectl delete deploy nginx-manual

#Create a deployment from a file in a namespace

#See deployment in a specific namespace
kubectl get deploy -n shikki

#Delete resource created from file in a namespace

#Set alias for kubectl
#powershell
Set-Alias -name k -value kubectl
#bash
alias k=kubectl

#Create a deployment using the alias

#Get full deployment as yaml
k get deploy nginx-deployment -n shikki -o yaml

#Get pods of the deployment
k get po -n shikki

#View the image used by a deployment
k get deploy nginx-deployment -n shikki `

#Change the image of a deployment
k set image deployment nginx-deployment -n shikki nginx=busybox:latest

#Change the image of a deployment
k set image deployment nginx-deployment -n shikki nginx=nginx:latest

#See the rollout history of a deployment
k rollout history deployment/nginx-deployment -n shikki

#Undo to a certain revision
k rollout undo deployment/nginx-deployment -n shikki --to-revision=2

#Get all pods
k get po -A
k get po --all-namespaces

#Get specific property of the pod

#Edit an existing object
k edit po -n shikki nginx-deployment-67dffbbbb-wqd76

#Port forward to all pods in a deployment
k port-forward deploy/nginx-deployment 7070:80 -n shikki

#Patch deployment remove
kubectl patch deploy nginx-deployment -n shikki --type=json `
-p='[{ "op": "remove", "path": "/metadata/labels/app" }]'

#Patch deployment add
kubectl patch deploy nginx-deployment -n shikki --type=json `
-p='[{ "op": "add", "path": "/metadata/labels", "value": {"a": "b"} }]'
Рекомендации по теме
Комментарии
Автор

Nice, you're getting more and more confident in talking. Keep it up!

daniel.g