Commands - cordonezjolon/kubernetesCourses GitHub Wiki
kubectl get <TypeObject> <NameObject>
kubectl <create or apply> -f fileName.yaml
kubectl delete <TypeObject> <NameObject>
kubectl describe <TypeObject> <NameObject>
kubectl edit <TypeObject> <NameObject>
kubectl scale <TypeObject> <NameObject> --replicas=<NumberOfReplicas>
kubectl apply -f <FileName>
- Apply version changes to deployment
kubectl rollout deployment/<DeploymentName> - View deployment history
kubectl rollout history deployment/<DeploymentName> - Rollback deployment
kubectl rollout undo deployment/<DeploymentName> - Status deployment current status/ status logs
kubectl rollout status deployment/<DeploymentName>
kubectl get <object> --namespace=<namespaceName>
-
kubectl config set-context $(kubectl config current-context) --namespace=<namespaceName>After this command you dont have to use namespace flag.
kubectl get <object> --all-namespaces
-
kubectl run nginx --image=nginx --dry-run=client -o yamlUse de --dry-run=cliente to validate imperative commands and-o yamlto export the file on yaml format without create a file or an object inside the cluster. Also you can add> nginx-deployment.yamlto create a file and after that edit it.
grep enable-admission-plugins /etc/kubernetes/manifests/kube-apiserver.yaml
ps -ef | grep kube-apiserver | grep admission-plugins
This command allows you kubectl proxy 8001& start a proxy server on your local machine to access the API whitout expose it to internet.
curl localhost:8001/curl localhost:8001/apis/authorization.k8s.io to get information from API
kubectl convert -f ingress-old.yaml --output-version networking.k8s.io/v1 > ingress-new.ya ml