K8S Cheat Sheet
Quick Reference
#verify health of the cluster
kubectl get nodes
# List all deployments in all namespaces
kubectl get deployments --all-namespaces=true
# List all deployments in a specific namespace
# Format :kubectl get deployments --namespace <namespace-name>
kubectl get deployments --namespace kube-system
# List details about a specific deployment
# Format :kubectl describe deployment <deployment-name> --namespace <namespace-name>
kubectl describe deployment my-dep --namespace kube-system
# List pods using a specific label
# Format :kubectl get pods -l <label-key>=<label-value> --all-namespaces=true
kubectl get pods -l app=nginx --all-namespaces=true
# Get logs for all pods with a specific label
# Format :kubecl logs -l <label-key>=<label-value>
kubectl logs -l app=nginx --namespace kube-system
# set default Namespace context
kubectl config set-context --current --namespace=app-d
# List the pods
kubectl get pods -l app.kubernetes.io/name=vault
# Connect to the instance
kubectl exec -ti vault-0 -- vault operator init
# Create a namespace for your ingress resources
kubectl create namespace app-d
#Get status:
kubectl --namespace ingress-basic get services -o wide -w nginx-ingress-controller
kubectl get service -l app=nginx-ingress --namespace ingress-basic
kubectl get events -n app-d
kubectl.exe logs kyron-api-948458ffc-27b65
#Create two new deployments
kubectl apply -f ..\..\helm\app1.yaml --namespace app-d
kubectl apply -f ..\..\helm\app2.yaml --namespace app-d
kubectl apply -f ..\..\helm\api.yaml --namespace app-d
# Set Default Context
kubectl config set-context --current --namespace=app-d
# Delete deployments, service, and ingress
kubectl delete ingress kyron-api
kubectl.exe delete deployments kyron-api
kubectl.exe delete service kyron-api
#uninstall:
helm delete consul
kubectl delete namespace consulResources
To install the K8s Dasbhoard:
Additional way to export the k8s config - this didn't work for me tho :(
Creating Ingres using NGinx
Create a namespace for your ingress resources
Add the official stable repository
Use Helm to deploy an NGINX ingress controller
HELM
Get status:
Create two new deployments
K8s for
uninstall:
Create the ingres route in the hello-world-ingress.yaml, then load
Install curl in the pod using apt-get:
Access the Containers:
AKS
Alternative - use App Gateway Ingress Controller (AGIC)
Lets Encrypt
Last updated
Was this helpful?