[kubenetes] 1-2-1. 개발용도 쿠버네티스

kubenetes
Author
chan2slo chan2slo
Date
2022-07-25 21:15
Views
1279

[설치]
docker for mac/windows를 사용하고 있지 않기 때문에
minikube를 사용하여 이용한다.

minikube는 2가지 설치법이 존재
1. 버추얼 박스로 설치
2. 리눅스 서버에서 가상 머신 없이 도커 엔진 만으로 설치

나는 kvm으로 리눅스 가상환경에서 실습중이기때문에 2번으로 설치한다.

minikube & kubectl 다운로드

[root@minikube ~]# curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.12.0/minikube-linux-amd64
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 54.9M  100 54.9M    0     0  3121k      0  0:00:18  0:00:18 --:--:-- 3259k
[root@minikube ~]# chmod +x minikube && mv minikube /usr/local/bin/

[root@minikube ~]# curl -Lo kubectl http://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 41.9M  100 41.9M    0     0  3516k      0  0:00:12  0:00:12 --:--:-- 4254k
[root@minikube ~]# chmod +x kubectl && mv kubectl /usr/local/bin/

아래와 같은 명령어로 설치하면 되지만 에러 발생

[root@minikube ~]# minikube start --vm-driver=none 
* minikube v1.12.0 on Centos 7.9.2009
* Using the none driver based on user configuration
X Sorry, Kubernetes 1.18.3 requires conntrack to be installed in root's path

conntrack 설치해준다.

[root@minikube ~]# yum install conntrack
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
base                                                                                                         | 3.6 kB  00:00:00     
extras                                                                                                       | 2.9 kB  00:00:00     
updates                                                                                                      | 2.9 kB  00:00:00 

다시 minikube실행해보면 잘됨

[root@minikube ~]# minikube start --vm-driver=none 
* minikube v1.12.0 on Centos 7.9.2009
* Using the none driver based on user configuration
* Starting control plane node minikube in cluster minikube
* Running on localhost (CPUs=2, Memory=3789MB, Disk=17397MB) ...
* minikube 1.19.0 is available! Download it: https://github.com/kubernetes/minikube/releases/tag/v1.19.0
* To disable this notice, run: 'minikube config set WantUpdateNotification false'

* OS release is CentOS Linux 7 (Core)
* Preparing Kubernetes v1.18.3 on Docker 20.10.6 ...
    > kubelet.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
    > kubectl.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
    > kubeadm.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
    > kubeadm: 37.97 MiB / 37.97 MiB [---------------] 100.00% 2.02 MiB p/s 19s
    > kubectl: 41.99 MiB / 41.99 MiB [---------------] 100.00% 1.42 MiB p/s 30s
    > kubelet: 108.04 MiB / 108.04 MiB [-------------] 100.00% 2.81 MiB p/s 39s
* Configuring local host environment ...
* 
! The 'none' driver is designed for experts who need to integrate with an existing VM
* Most users should use the newer 'docker' driver instead, which does not require root!
* For more information, see: https://minikube.sigs.k8s.io/docs/reference/drivers/none/
* 
! kubectl and minikube configuration will be stored in /root
! To use kubectl or minikube commands as your own user, you may need to relocate them. For example, to overwrite your own settings, run:
* 
  - sudo mv /root/.kube /root/.minikube $HOME
  - sudo chown -R $USER $HOME/.kube $HOME/.minikube
* 
* This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
* Verifying Kubernetes components...
* Enabled addons: default-storageclass, storage-provisioner
* Done! kubectl is now configured to use "minikube"

kubectl 명령 잘 수행되는지 확인

[root@minikube ~]# kubectl version --short
Client Version: v1.18.0
Server Version: v1.18.3
Total Reply 0