Overview: Minikube creates a virtual machine (VM) running Linux to simulate a Kubernetes cluster (not a real cluster).
Installation:
Download Minikube:
curl -L0 <https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64>
Install Minikube:
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
Add alias for kubectl
in ~/.bashrc
:
vim ~/.bashrc
alias kubectl="minikube kubectl --"
source ~/.bashrc
Manage Minikube:
Start the cluster:
minikube start
Check cluster status:
minikube status
Stop the cluster (does not delete it):
minikube stop
Delete the cluster (removes the VM; requires reinstallation with minikube start
):
minikube delete
Access the VM shell:
minikube ssh
Get cluster information:
minikube kubectl -- cluster-info
kubectl cluster-info
Expose a service outside the cluster:
minikube service <service name>
List objects:
kubectl get <object>
Describe an object:
kubectl describe <object> <object name>
Delete an object:
kubectl delete <object> <object name>
List nodes:
kubectl get nodes
kubectl get node
Describe a node:
kubectl describe node <node name>
List namespaces:
kubectl get namespaces
kubectl get namespace
kubectl get ns
Create a namespace:
kubectl create namespace myns
Delete a namespace (deletes all members within it):
kubectl delete namespace myns
List pods in the default namespace:
kubectl get pods
kubectl get pod
List pods with detailed information:
kubectl get pods -o wide