Kubernetes : Minikube : Install2019/08/26 |
Configure Kubernetes which is Docker Container Orchestration System.
On this exmaple, Install Minikube to configure Single Node Cluster within a Virtual machine.
|
[1] | Because using VM, Install a Hypervisor which is supported by Minikube. On this example, Install KVM. For other Hypervisors, it's possible to use VirtualBox, VMware Fusion, HyperKit. |
root@dlp:~# apt -y install qemu-kvm libvirt-daemon libvirt-daemon-system virtinst bridge-utils
|
[2] | Configure Kubernetes repository and Install Minikube. |
root@dlp:~#
root@dlp:~# apt -y install apt-transport-https gnupg2 curl curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - OK
root@dlp:~#
root@dlp:~# echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list root@dlp:~# apt update root@dlp:~# apt -y install kubectl
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O minikube root@dlp:~# wget https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 root@dlp:~# chmod 755 minikube docker-machine-driver-kvm2
root@dlp:~#
mv minikube docker-machine-driver-kvm2 /usr/local/bin/
root@dlp:~#
root@dlp:~# minikube version minikube version: v1.3.1 commit: ca60a424ce69a4d79f502650199ca2b52f29e631 kubectl version -o json { "clientVersion": { "major": "1", "minor": "15", "gitVersion": "v1.15.3", "gitCommit": "2d3c76f9091b6bec110a5e63777c332469e0cba2", "gitTreeState": "clean", "buildDate": "2019-08-19T11:13:54Z", "goVersion": "go1.12.9", "compiler": "gc", "platform": "linux/amd64" } } The connection to the server localhost:8080 was refused - did you specify the right host or port? # start minikube root@dlp:~# minikube start --vm-driver kvm2 * minikube v1.3.1 on Debian 10.0 ! Please don't run minikube as root or with 'sudo' privileges. It isn't necessary with kvm2 driver. * Downloading VM boot image ... minikube-v1.3.0.iso.sha256: 65 B / 65 B [--------------------] 100.00% ? p/s 0s minikube-v1.3.0.iso: 131.07 MiB / 131.07 MiB [-------] 100.00% 37.85 MiB p/s 4s * Creating kvm2 VM (CPUs=2, Memory=2000MB, Disk=20000MB) ... * Preparing Kubernetes v1.15.2 on Docker 18.09.8 ... * Downloading kubelet v1.15.2 * Downloading kubeadm v1.15.2 * Pulling images ... * Launching Kubernetes ... * Waiting for: apiserver proxy etcd scheduler controller dns * Done! kubectl is now configured to use "minikube" # show status root@dlp:~# minikube status host: Running kubelet: Running apiserver: Running kubectl: Correctly Configured: pointing to minikube-vm at 192.168.39.235 minikube service list |-------------|------------|--------------| | NAMESPACE | NAME | URL | |-------------|------------|--------------| | default | kubernetes | No node port | | kube-system | kube-dns | No node port | |-------------|------------|--------------|root@dlp:~# minikube docker-env export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://192.168.39.235:2376" export DOCKER_CERT_PATH="/root/.minikube/certs" # Run this command to configure your shell: # eval $(minikube docker-env)root@dlp:~# kubectl cluster-info Kubernetes master is running at https://192.168.39.235:8443 KubeDNS is running at https://192.168.39.235:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.root@dlp:~# kubectl get nodes NAME STATUS ROLES AGE VERSION minikube Ready master 3m6s v1.15.2 # a VM [minikube] is just running root@dlp:~# virsh list Id Name State ---------------------------------------------------- 1 minikube running # possible to access with SSH to the VM root@dlp:~# minikube ssh _ _ _ _ ( ) ( ) ___ ___ (_) ___ (_)| |/') _ _ | |_ __ /' _ ` _ `\| |/' _ `\| || , < ( ) ( )| '_`\ /'__`\ | ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )( ___/ (_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)
$
$ hostname minikube docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4b7d81d86aea eb516548c180 "/coredns -conf /etc…" 4 minutes ago Up 3 minutes k8s_coredns_coredns-5c98db65d4-8l7xj_kube-system_8c1a1285-6dc3-47d9-961a-31e23e32d56e_1 815834bc0876 eb516548c180 "/coredns -conf /etc…" 4 minutes ago Up 3 minutes k8s_coredns_coredns-5c98db65d4-p265w_kube-system_59344609-d3a7-4187-b498-aeed78ede5e1_1 18730b9af447 4689081edb10 "/storage-provisioner" 4 minutes ago Up 4 minutes k8s_storage-provisioner_storage-provisioner_kube-system_5156ce8e-30c3-4bfb-8973-86c5fe40b5ac_0 b6f3b694a9ec k8s.gcr.io/pause:3.1 "/pause" 4 minutes ago Up 4 minutes k8s_POD_storage-provisioner_kube-system_5156ce8e-30c3-4bfb-8973-86c5fe40b5ac_0 29db40f61abe 167bbf6c9338 "/usr/local/bin/kube…" 4 minutes ago Up 4 minutes k8s_kube-proxy_kube-proxy-9jvcm_kube-system_f350443a-3aed-4c78-97ae-b850e89f0c8b_0 a8f8035a3c24 k8s.gcr.io/pause:3.1 "/pause" 4 minutes ago Up 4 minutes k8s_POD_coredns-5c98db65d4-8l7xj_kube-system_8c1a1285-6dc3-47d9-961a-31e23e32d56e_0 0a507fb15081 k8s.gcr.io/pause:3.1 "/pause" 4 minutes ago Up 4 minutes k8s_POD_kube-proxy-9jvcm_kube-system_f350443a-3aed-4c78-97ae-b850e89f0c8b_0 e4004329addf k8s.gcr.io/pause:3.1 "/pause" 4 minutes ago Up 4 minutes k8s_POD_coredns-5c98db65d4-p265w_kube-system_59344609-d3a7-4187-b498-aeed78ede5e1_0 27d040b6877b 2c4adeb21b4f "etcd --advertise-cl…" 5 minutes ago Up 4 minutes k8s_etcd_etcd-minikube_kube-system_6410149bd21c729e04a5211451d6c0c1_0 49fa5ee396e4 34a53be6c9a7 "kube-apiserver --ad…" 5 minutes ago Up 4 minutes k8s_kube-apiserver_kube-apiserver-minikube_kube-system_87481840a32bd7ae50049f0cf5c0a9cc_0 3b7f678f892a 88fa9cb27bd2 "kube-scheduler --bi…" 5 minutes ago Up 4 minutes k8s_kube-scheduler_kube-scheduler-minikube_kube-system_abfcb4f52e957b11256c1f6841d49700_0 73fa5f51ad74 9f5df470155d "kube-controller-man…" 5 minutes ago Up 5 minutes k8s_kube-controller-manager_kube-controller-manager-minikube_kube-system_374ab60c7462b3f9c28c5cc2355d6d08_0 e5722f3ac286 119701e77cbc "/opt/kube-addons.sh" 5 minutes ago Up 4 minutes k8s_kube-addon-manager_kube-addon-manager-minikube_kube-system_65a31d2b812b11a2035f37c8a742e46f_0 444e58920377 k8s.gcr.io/pause:3.1 "/pause" 5 minutes ago Up 5 minutes k8s_POD_kube-apiserver-minikube_kube-system_87481840a32bd7ae50049f0cf5c0a9cc_0 d865126f3eb2 k8s.gcr.io/pause:3.1 "/pause" 5 minutes ago Up 5 minutes k8s_POD_etcd-minikube_kube-system_6410149bd21c729e04a5211451d6c0c1_0 1e5bd76e4ba7 k8s.gcr.io/pause:3.1 "/pause" 5 minutes ago Up 5 minutes k8s_POD_kube-addon-manager-minikube_kube-system_65a31d2b812b11a2035f37c8a742e46f_0 ce66316fbf0d k8s.gcr.io/pause:3.1 "/pause" 5 minutes ago Up 5 minutes k8s_POD_kube-scheduler-minikube_kube-system_abfcb4f52e957b11256c1f6841d49700_0 8d1b23cc07d8 k8s.gcr.io/pause:3.1 "/pause" 5 minutes ago Up 5 minutes k8s_POD_kube-controller-manager-minikube_kube-system_374ab60c7462b3f9c28c5cc2355d6d08_0
$
exit
# to stop minikube, do like follows root@dlp:~# minikube stop Stopping local Kubernetes cluster... Machine stopped. # to remove minikube, do like follows root@dlp:~# minikube delete Deleting local Kubernetes cluster... Machine deleted. virsh list --all Id Name State ---------------------------------------------------- |
Sponsored Link |