How To Handle Minikube(Cheatsheet)-1? K8s – Part: 7

0
280
views
How To Handle Minikube(Cheatsheet)-1? K8s - Part: 7

Handle Minikube (Cheatsheet)?

Minikube is used to run a single-node Kubernetes cluster inside a VM for trying out Kubernetes or for development purpose. Now in this article, we will get to know about the most useful command which we can be used to maintain our single node Kubernetes cluster. This will also help to the development and learn Kubernetes cluster environment.

For this article, you should have a Minikube environment on your system. If you don’t have then see the previous link for setup. Well, it’s a long list so just be ready on your system to check them one by one. I have divided this command cheatsheet among 5 Major Parts

List is below

  • Minikube Administration
  • Minikiube App Deployments & Administration
  • Clean Up
  • Few Troubleshoots
  • Important File Directory Information

Let’s Start

Section 1: Minikube Administration

This section is all about minikube administration commands.

COMMAND 1: Clean the configurations and start clean

[[email protected] ~]# minikube delete
Deleting local Kubernetes cluster...
Machine deleted.

COMMAND 2: Get Minikube Service UP

[[email protected] ~]# minikube start
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Downloading Minikube ISO
160.27 MB / 160.27 MB [============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
................................
....................................
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.




COMMAND 3: Start Kubernets with specific Version

[[email protected] ~]# minikube start --kubernetes-version v1.11.3
Starting local Kubernetes v1.11.3 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
………………………………….

COMMAND 4: Start Minikube Service with 2 CPUs and 4096 of memory

[[email protected] ~]# minikube start --cpus 2 --memory 4096
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
……………………….

COMMAND 5: To Get Cluster Information

Assuming your Minikube starts up well. We can now issue kubectl commands to it.

[[email protected] ~]# kubectl cluster-info
Kubernetes master is running at https://192.168.99.100:8443
KubeDNS is running at https://192.168.99.100:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

COMMAND 6: Get Supported Kubernets version

[[email protected] ~]# minikube get-k8s-versions
The following Kubernetes versions are available when using the localkube bootstrapper:
- v1.10.0
- v1.9.4
…………………………………..
……………………………………….
- v1.3.3
- v1.3.0

COMMAND 7: Get minikube version, link: all minikube releases

[[email protected] ~]# minikube version
minikube version: v0.28.2

COMMAND 8: To get Minikube status (Like if IP get changed)

[[email protected] ~]# minikube status
minikube: Running
cluster: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100




COMMAND 9: Get Minikube IP

[[email protected] ~]# minikube ip
192.168.99.100

COMMAND 10: Get Logs Of minikube

[[email protected] ~]# minikube logs
-- Logs begin at Thu 2018-09-27 09:16:11 UTC, end at Thu 2018-09-27 09:32:51 UTC.
Sep 27 09:17:18 minikube systemd[1]: Started kubelet: The Kubernetes Node Agent.
Sep 27 09:17:18 minikube kubelet[2650]: Flag --client-ca-file has been deprecated,
…..
…………..

COMMAND 11: To set minikube docker-env

[[email protected] ~]# minikube docker-env
$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://192.168.99.100:2376"
$Env:DOCKER_CERT_PATH = "C:\Users\ksingh\.minikube\certs"
$Env:DOCKER_API_VERSION = "1.35"
# Run this command to configure your shell:
# & minikube docker-env | Invoke-Expression

COMMAND 12: List Get all addons for minikube

[[email protected] ~]# minikube addons list
- addon-manager: enabled
- coredns: disabled
- dashboard: enabled
- default-storageclass: enabled
- efk: disabled
- freshpod: disabled
- heapster: disabled
- ingress: disabled
- kube-dns: enabled
- metrics-server: disabled
- nvidia-driver-installer: disabled
- nvidia-gpu-device-plugin: disabled
- registry: disabled
- registry-creds: disabled
- storage-provisioner: enabled

For further Minikube cheatsheet, follow these link:
Cheatsheet-2
Cheatsheet-3

Kubernetes Series Links:

Understanding Kubernetes Concepts RHEL/CentOs K8s Part-1
Understanding Kubernetes Concepts RHEL/CentOs k8s: Part-2
How to Install Kubernetes on CentOS/RHEL k8s?: Part-3
How to Install Kubernetes on CentOS/RHEL k8s?: Part-4
How To Bring Up The Kubernetes Dashboard? K8s-Part: 5
How to Run Kubernetes Cluster locally (minikube)? K8s – Part: 6
How To Handle Minikube(Cheatsheet)-3? K8s – Part: 7
How To Handle Minikube(Cheatsheet)-3? K8s – Part: 8
How To Handle Minikube(Cheatsheet)-3? K8s – Part: 9