[CentOS7] KVM minikube install

CentOS7 minikube 설치

참고 페이지 : https://kubernetes.io/ko/docs/tasks/tools/install-minikube/

https://computingforgeeks.com/how-to-run-minikube-on-kvm/

kvm 환경에서 minikube 설치 방법을 정리 하였습니다. Virtualbox 및 vmware 에서는 kubernetes 3 node 구성이 좀더 편하게 설치 됩니다. 🙂

 

 

1. 가상화 지원 확인

[root@kvm-server01 ~]# grep -E --color 'vmx|svm' /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall
nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cp
l vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt aes lahf_lm ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid
dtherm ida arat spec_ctrl intel_stibp flush_l1d
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall
nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cp
l vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt aes lahf_lm ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid
dtherm ida arat spec_ctrl intel_stibp flush_l1d
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall
nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cp
l vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt aes lahf_lm ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid
dtherm ida arat spec_ctrl intel_stibp flush_l1d
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall
nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cp
l vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt aes lahf_lm ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid
dtherm ida arat spec_ctrl intel_stibp flush_l1d
~ 중략

 

 

2. Download minikube

[root@kvm-server01 ~]# wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
[root@kvm-server01 ~]# chmod +x minikube-linux-amd64
[root@kvm-server01 ~]# mv minikube-linux-amd64 /usr/local/bin/minikube
[root@kvm-server01 ~]# minikube version
minikube version: v1.3.1
commit: ca60a424ce69a4d79f502650199ca2b52f29e631
[root@kvm-server01 ~]#

 

 

3. Install kubectl

[root@kvm-server01 ~]# curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 40.9M 100 40.9M 0 0 29.0M 0 0:00:01 0:00:01 --:--:-- 29.0M
[root@kvm-server01 ~]# chmod +x kubectl
[root@kvm-server01 ~]# mv kubectl /usr/local/bin/
[root@kvm-server01 ~]# 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?
[root@kvm-server01 ~]#

 

 

4. Install Docker Machine KVM Driver

[root@kvm-server01 ~]# curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.8M 100 13.8M 0 0 13.4M 0 0:00:01 0:00:01 --:--:-- 13.5M
[root@kvm-server01 ~]#
[root@kvm-server01 ~]# chmod +x docker-machine-driver-kvm2
[root@kvm-server01 ~]# mv docker-machine-driver-kvm2 /usr/local/bin/

Starting minikube

[root@kvm-server01 ~]# chmod +x docker-machine-driver-kvm2
[root@kvm-server01 ~]# mv docker-machine-driver-kvm2 /usr/local/bin/
[root@kvm-server01 ~]# minikube start --vm-driver kvm2
* minikube v1.3.1 on Centos 7.6.1810
! 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% 48.99 MiB p/s 3s
* Creating kvm2 VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
* Preparing Kubernetes v1.15.2 on Docker 18.09.8 ...
* Downloading kubeadm v1.15.2
* Downloading kubelet v1.15.2
* Pulling images ...
* Launching Kubernetes ...
* Waiting for: apiserver proxy etcd scheduler controller dns
* Done! kubectl is now configured to use "minikube"
[root@kvm-server01 ~]#


[root@kvm-server01 ~]# sudo virsh list |grep mini
320 minikube running
[root@kvm-server01 ~]#

[root@kvm-server01 ~]# kubectl cluster-info
Kubernetes master is running at https://192.168.39.228:8443
KubeDNS is running at https://192.168.39.228:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
[root@kvm-server01 ~]#


[root@kvm-server01 ~]# kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority: /root/.minikube/ca.crt
server: https://192.168.39.228:8443
name: minikube
contexts:
- context:
cluster: minikube
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
user:
client-certificate: /root/.minikube/client.crt
client-key: /root/.minikube/client.key
[root@kvm-server01 ~]#


[root@kvm-server01 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 15m v1.15.2
[root@kvm-server01 ~]# minikube ssh
_ _
_ _ ( ) ( )
___ ___ (_) ___ (_)| |/') _ _ | |_ __
/' _ ` _ `\| |/' _ `\| || , < ( ) ( )| '_`\ /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )( ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

$ cat /etc/os-release
NAME=Buildroot
VERSION=2018.05.3
ID=buildroot
VERSION_ID=2018.05.3
PRETTY_NAME="Buildroot 2018.05.3"
$

 

 

댓글 남기기