User Tools

Site Tools


k8s

Kubernetes commands

Kubectl CheatSheet

alias k='kubectl'

k --help

kubectx
kubens
kubectx -c && kubens -c

k config current-context
k get nodes -o wide

k get all
k get all -A
k get all -n mynamespace

k apply -f myfile.yml
k delete -f myfile.yml

k get po [-o wide] [-w]
k get svc [-o wide] [-w]
k get deploy [-o wide] [-w]
k get ns
k get secret
k get configmap
k delete svc,deploy NAME

k logs <po-name>
k describe po <po-name>

k get secret
k get secret -A
k get secret <secret-name> -o yaml
k create secret generic <secret-name> --from-literal=mykey=myvalue [--from-file=./myfile.txt] -n <my-namespace>

Install Minikube and Kubectl to work locally

Follow instructions here :

Then, you have a VM with Kubernetes installed :

minikube start # to start the VM
minikube stop # to stop the VM
minikube dashboard # to see the K8S Dashboard
minikube ssh # to connect to the VM with SSH, to see your docker images, etc.
k8s.txt · Last modified: 2021/03/04 08:20 by jdx