Skip to main content

Setup Kubernetes

Getting Started

Drivers

Hyper-V

  1. Enable Microsoft Hyper-V:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
  1. Create Virtual Switch

Cluster

Runtime configuration

kubectl version

options

--hyperv-virtual-switch=<external-switch-name>
--driver=hyperv|docker|virtualbox

container-runtime

minikube config set container-runtime=docker|containerd|cri-o

driver

minikube config set driver hyperv|docker|virtualbox

Manage instance

commands

minikube start
minikube stop
minikube delete

kubectl cluster-info
minikube dashboard

kubectl

Retrieve pod deployment auto-generated status data

kubectl get deployment <service-name> -o yaml > service-deployment-etcd.yaml

Manage components

Namespaces:

kubectl create namespace <name>
kubectl delete namespace <name>

All:

kubectl get all -n <namespace>
kubectl get po -A
kubectl get all
kubectl get pods --output wide
kubectl get pods --watch
kubectl get pods --show-labels
kubectl get service
kubectl get rs

Manage configuration files

kubectl apply -f <name>.yaml
kubectl delete -f <name>.yaml

Apply all configuration files in a directory:

kubectl apply $(ls pattern*.yaml | awk ' { print " -f " $1 } ')
kubectl delete services <name> <another-name>
kubectl delete deployment <name> <another-name>

Create base64 values for use in secret files

echo -n 'value' | base64

Manage deployments

Update a deployment:

kubectl edit deployment.v1.apps/name-deployment
kubectl get deployments
kubectl rollout status deployment/name-deployment

kubectl describe deployments
kubectl describe po -n <namespace> <pod-name>
kubectl describe pod <name>

Setup Addons

Setup Ingress Nginx