Difference between revisions of "Kubernetes/minikube"
Jump to navigation
Jump to search
(→Usage) |
(→Usage) |
||
Line 89: | Line 89: | ||
minikube delete #delete your local cluster | minikube delete #delete your local cluster | ||
</source> | </source> | ||
Working with profiles | |||
<source lang=bash> | |||
$ ls -1 ~/.minikube/profiles/ #list all profiles | |||
aws-v1.13.7-cluster | |||
minikube #default profile | |||
</source> | |||
{| class="wikitable" | |||
|+ Example of <code>~/.minikube/profiles/<minikube-profile>/config.json</code> | |||
|- | |||
! <code>jq .MachineConfig config.json</code> | |||
! <code>jq .KubernetesConfig config.json</code> | |||
|- style="vertical-align:top;" | |||
| <source lang=json> | |||
{ | |||
"KubernetesVersion": "v1.13.7", | |||
"NodeIP": "192.168.99.102", | |||
"NodePort": 8443, | |||
"NodeName": "minikube", | |||
"APIServerName": "minikubeCA", | |||
"APIServerNames": null, | |||
"APIServerIPs": null, | |||
"DNSDomain": "cluster.local", | |||
"ContainerRuntime": "docker", | |||
"CRISocket": "", | |||
"NetworkPlugin": "", | |||
"FeatureGates": "", | |||
"ServiceCIDR": "10.96.0.0/12", | |||
"ImageRepository": "", | |||
"ExtraOptions": null, | |||
"ShouldLoadCachedImages": true, | |||
"EnableDefaultCNI": false | |||
} </source> | |||
| <source lang=json> | |||
{ | |||
"KeepContext": false, | |||
"MinikubeISO": "https://storage.googleapis.com/minikube/iso/minikube-v1.2.0.iso", | |||
"Memory": 2048, | |||
"CPUs": 2, | |||
"DiskSize": 20000, | |||
"VMDriver": "virtualbox", | |||
"ContainerRuntime": "docker", | |||
"HyperkitVpnKitSock": "", | |||
"HyperkitVSockPorts": [], | |||
"XhyveDiskDriver": "ahci-hd", | |||
"DockerEnv": null, | |||
"InsecureRegistry": null, | |||
"RegistryMirror": null, | |||
"HostOnlyCIDR": "192.168.99.1/24", | |||
"HypervVirtualSwitch": "", | |||
"KvmNetwork": "default", | |||
"DockerOpt": null, | |||
"DisableDriverMounts": false, | |||
"NFSShare": [], | |||
"NFSSharesRoot": "/nfsshares", | |||
"UUID": "", | |||
"GPU": false, | |||
"Hidden": false, | |||
"NoVTXCheck": false | |||
} </source> | |||
|} | |||
= Addons = | = Addons = |
Revision as of 19:59, 28 July 2019
Features v1.2.0
- LoadBalancer - using
minikube tunnel
- Multi-cluster - using
minikube start -p <name>
- NodePorts - using
minikube service
- Persistent Volumes
- Ingress
- RBAC
- Dashboard -
minikube dashboard
- Container runtimes -
start --container-runtime
- Configure apiserver and kubelet options via command-line flags
Install on Linux
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && sudo install minikube-linux-amd64 /usr/local/bin/minikube % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 39.8M 100 39.8M 0 0 160k 0 0:04:14 0:04:14 --:--:-- 174k
Start
Example of start sequence
minikube start 😄 minikube v1.2.0 on linux (amd64) 🔥 Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ... 🐳 Configuring environment for Kubernetes v1.15.0 on Docker 18.09.6 E0728 00:14:31.657125 26453 start.go:403] Error caching images: Caching images for kubeadm: caching images: caching image /home/user1/.minikube/cache/images/k8s.gcr.io/k8s-dns-kube-dns-amd64_1.14.13: stream error: stream ID 25; INTERNAL_ERROR ❌ Unable to load cached images: loading cached images: loading image /home/pipaw/.minikube/cache/images/k8s.gcr.io/k8s-dns-sidecar-amd64_1.14.13: stat /home/user1/.minikube/cache/images/k8s.gcr.io/k8s-dns-sidecar-amd64_1.14.13: no such file or directory 💾 Downloading kubeadm v1.15.0 💾 Downloading kubelet v1.15.0 🚜 Pulling images ... 🚀 Launching Kubernetes ... ⌛ Verifying: apiserver proxy etcd scheduler controller dns 🏄 Done! kubectl is now configured to use "minikube" $ minikube status host: Running kubelet: Running apiserver: Running kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.101 $ kubectl get nodes -o wide NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME minikube Ready master 8h v1.15.0 10.0.2.15 <none> Buildroot 2018.05.3 4.15.0 docker://18.9.6 $ kubectl get all -o wide --all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES kube-system pod/coredns-5c98db65d4-d688k 1/1 Running 0 8h 172.17.0.2 minikube <none> <none> kube-system pod/coredns-5c98db65d4-xdq6d 1/1 Running 0 8h 172.17.0.3 minikube <none> <none> kube-system pod/etcd-minikube 1/1 Running 0 8h 10.0.2.15 minikube <none> <none> kube-system pod/kube-addon-manager-minikube 1/1 Running 0 8h 10.0.2.15 minikube <none> <none> kube-system pod/kube-apiserver-minikube 1/1 Running 0 8h 10.0.2.15 minikube <none> <none> kube-system pod/kube-controller-manager-minikube 1/1 Running 0 8h 10.0.2.15 minikube <none> <none> kube-system pod/kube-proxy-j5f2h 1/1 Running 0 8h 10.0.2.15 minikube <none> <none> kube-system pod/kube-scheduler-minikube 1/1 Running 0 8h 10.0.2.15 minikube <none> <none> kube-system pod/storage-provisioner 1/1 Running 0 8h 10.0.2.15 minikube <none> <none> NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR default service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 8h <none> kube-system service/kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 8h k8s-app=kube-dns NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE CONTAINERS IMAGES SELECTOR kube-system daemonset.apps/kube-proxy 1 1 1 1 1 beta.kubernetes.io/os=linux 8h kube-proxy k8s.gcr.io/kube-proxy:v1.15.0 k8s-app=kube-proxy NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR kube-system deployment.apps/coredns 2/2 2 2 8h coredns k8s.gcr.io/coredns:1.3.1 k8s-app=kube-dns NAMESPACE NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR kube-system replicaset.apps/coredns-5c98db65d4 2 2 2 8h coredns k8s.gcr.io/coredns:1.3.1 k8s-app=kube-dns,pod-template-hash=5c98db65d4
Usage
time minikube start #start a cluster by running time minikube start --kubernetes-version v1.15.0 # AWS versions 1.13.7,1.12.6 minikube dashboard #access Kubernetes Dashboard within Minikube #Use kubectl to interact with the local cluster kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port=8080 kubectl expose deployment hello-minikube --type=NodePort #Exposing a service as a NodePort #minikube makes it easy to open this exposed endpoint in your browser minikube service hello-minikube #Start a second local cluster: minikube start -p cluster2 minikube stop #stop your local cluster minikube delete #delete your local cluster
Working with profiles
$ ls -1 ~/.minikube/profiles/ #list all profiles aws-v1.13.7-cluster minikube #default profile
jq .MachineConfig config.json
|
jq .KubernetesConfig config.json
|
---|---|
{ "KubernetesVersion": "v1.13.7", "NodeIP": "192.168.99.102", "NodePort": 8443, "NodeName": "minikube", "APIServerName": "minikubeCA", "APIServerNames": null, "APIServerIPs": null, "DNSDomain": "cluster.local", "ContainerRuntime": "docker", "CRISocket": "", "NetworkPlugin": "", "FeatureGates": "", "ServiceCIDR": "10.96.0.0/12", "ImageRepository": "", "ExtraOptions": null, "ShouldLoadCachedImages": true, "EnableDefaultCNI": false } |
{ "KeepContext": false, "MinikubeISO": "https://storage.googleapis.com/minikube/iso/minikube-v1.2.0.iso", "Memory": 2048, "CPUs": 2, "DiskSize": 20000, "VMDriver": "virtualbox", "ContainerRuntime": "docker", "HyperkitVpnKitSock": "", "HyperkitVSockPorts": [], "XhyveDiskDriver": "ahci-hd", "DockerEnv": null, "InsecureRegistry": null, "RegistryMirror": null, "HostOnlyCIDR": "192.168.99.1/24", "HypervVirtualSwitch": "", "KvmNetwork": "default", "DockerOpt": null, "DisableDriverMounts": false, "NFSShare": [], "NFSSharesRoot": "/nfsshares", "UUID": "", "GPU": false, "Hidden": false, "NoVTXCheck": false } |
Addons
minikube addons enable heapster #get some insight into CPU
References
- minikube Github