티스토리 뷰

728x90
반응형

본 포스팅에서는 Kubernetes의 경량화 버전인 minikube에 대해 살펴보겠습니다.

minikube는 로컬이나 단일 환경에 손쉽게 Kubernetes를 구성하기 위한 방식으로 아래와 같은 몇가지 스텝만으로도 쿠버네티스를 구축하고 컨테이너 환경을 사용할 수 있습니다.

minikube 설치

[root@kubemaster minikube]# curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current 
                                 Dload  Upload   Total   Spent    Left  Speed 
100 48.2M  100 48.2M    0     0   9.8M      0  0:00:04  0:00:04 --:--:-- 11.3M 
[root@kubemaster minikube]# ./minikube start --vm-driver=none 
* minikube v1.7.3 on Centos 7.6.1810 
* Using the none driver based on user configuration 
* Running on localhost (CPUs=2, Memory=2846MB, Disk=47073MB) ... 
* OS release is CentOS Linux 7 (Core) 
! Node may be unable to resolve external DNS records 
* Preparing Kubernetes v1.17.3 on Docker 18.09.7 ... 
* Downloading kubelet v1.17.3 
* Downloading kubeadm v1.17.3 
* Downloading kubectl v1.17.3 
* Launching Kubernetes ...  
* Enabling addons: default-storageclass, storage-provisioner 
* Configuring local host environment ... 
*  
! The 'none' driver provides limited isolation and may reduce system security and reliability. 
! 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 
* Waiting for cluster to come online ... 
* Done! kubectl is now configured to use "minikube" 
* For best results, install kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/ 
[root@kubemaster minikube]#

먼저 위와 같이 minikube 바이너리를 다운로드 받습니다.

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube 

다운로드가 완료되면, 다음과 같이 minikube를 실행합니다.

./minikube start --vm-driver=none 

Done! kubectl is now configured to use "minikube"라는 메시지가 출력되면, minikube 환경 구성이 완료된 것입니다.

설치 간 아래와 같은 오류가 나타 날 경우에는 yum install로 conntrack을 설치한 후 기동한다.

[root@kubemaster ~]# ./minikube start --vm-driver=none 
* minikube v1.12.3 on Centos 7.6.1810
* Using the none driver based on user configuration
X Sorry, Kubernetes 1.18.3 requires conntrack to be installed in root's path
[root@kubemaster ~]# yum install -y conntrack
extras                                                                                                                                                                                                               | 2.9 kB  00:00:00     
gitlab_gitlab-ce/x86_64/signature                                                                                                                                                                                    |  862 B  00:00:00     
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Importing GPG key 0x51312F3F:
 Userid     : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
 Fingerprint: f640 3f65 44a3 8863 daa0 b6e0 3f01 618a 5131 2f3f
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
gitlab_gitlab-ce/x86_64/signature                                                                                                                                                                                    | 1.0 kB  00:00:00 !!! 
gitlab_gitlab-ce-source/signature                                                                                                                                                                                    |  862 B  00:00:00     
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Importing GPG key 0x51312F3F:
 Userid     : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
 Fingerprint: f640 3f65 44a3 8863 daa0 b6e0 3f01 618a 5131 2f3f
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
gitlab_gitlab-ce-source/signature                                                                                                                                                                                    |  951 B  00:00:00 !!! 
updates                                                                                                                                                                                                              | 2.9 kB  00:00:00     
(1/2): extras/7/x86_64/primary_db                                                                                                                                                                                    | 206 kB  00:00:00     
(2/2): updates/7/x86_64/primary_db                                                                                                                                                                                   | 3.8 MB  00:00:00     
(1/2): gitlab_gitlab-ce-source/primary                                                                                                                                                                               |  175 B  00:00:01     
(2/2): gitlab_gitlab-ce/x86_64/primary                                                                                                                                                                               | 2.3 MB  00:00:04     
base/7/x86_64/primary_db                                                                                                                                                                                             | 6.1 MB  00:00:00     
gitlab_gitlab-ce                                                                                                                                                                                                                    620/620
ius/x86_64/primary                                                                                                                                                                                                   | 113 kB  00:00:00     
ius                                                                                                                                                                                                                                 483/483
Resolving Dependencies
--> Running transaction check
---> Package conntrack-tools.x86_64 0:1.4.4-7.el7 will be installed
--> Processing Dependency: libnetfilter_cttimeout.so.1(LIBNETFILTER_CTTIMEOUT_1.1)(64bit) for package: conntrack-tools-1.4.4-7.el7.x86_64
--> Processing Dependency: libnetfilter_cttimeout.so.1(LIBNETFILTER_CTTIMEOUT_1.0)(64bit) for package: conntrack-tools-1.4.4-7.el7.x86_64
--> Processing Dependency: libnetfilter_cthelper.so.0(LIBNETFILTER_CTHELPER_1.0)(64bit) for package: conntrack-tools-1.4.4-7.el7.x86_64
--> Processing Dependency: libnetfilter_queue.so.1()(64bit) for package: conntrack-tools-1.4.4-7.el7.x86_64
--> Processing Dependency: libnetfilter_cttimeout.so.1()(64bit) for package: conntrack-tools-1.4.4-7.el7.x86_64
--> Processing Dependency: libnetfilter_cthelper.so.0()(64bit) for package: conntrack-tools-1.4.4-7.el7.x86_64
--> Running transaction check
---> Package libnetfilter_cthelper.x86_64 0:1.0.0-11.el7 will be installed
---> Package libnetfilter_cttimeout.x86_64 0:1.0.0-7.el7 will be installed
---> Package libnetfilter_queue.x86_64 0:1.0.2-2.el7_2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================================================
 Package                                                             Arch                                                Version                                                    Repository                                         Size
============================================================================================================================================================================================================================================
Installing:
 conntrack-tools                                                     x86_64                                              1.4.4-7.el7                                                base                                              187 k
Installing for dependencies:
 libnetfilter_cthelper                                               x86_64                                              1.0.0-11.el7                                               base                                               18 k
 libnetfilter_cttimeout                                              x86_64                                              1.0.0-7.el7                                                base                                               18 k
 libnetfilter_queue                                                  x86_64                                              1.0.2-2.el7_2                                              base                                               23 k

Transaction Summary
============================================================================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 245 k
Installed size: 668 k
Downloading packages:
(1/4): libnetfilter_cthelper-1.0.0-11.el7.x86_64.rpm                                                                                                                                                                 |  18 kB  00:00:00     
(2/4): conntrack-tools-1.4.4-7.el7.x86_64.rpm                                                                                                                                                                        | 187 kB  00:00:00     
(3/4): libnetfilter_cttimeout-1.0.0-7.el7.x86_64.rpm                                                                                                                                                                 |  18 kB  00:00:00     
(4/4): libnetfilter_queue-1.0.2-2.el7_2.x86_64.rpm                                                                                                                                                                   |  23 kB  00:00:00     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                       1.9 MB/s | 245 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libnetfilter_queue-1.0.2-2.el7_2.x86_64                                                                                                                                                                                  1/4 
  Installing : libnetfilter_cthelper-1.0.0-11.el7.x86_64                                                                                                                                                                                2/4 
  Installing : libnetfilter_cttimeout-1.0.0-7.el7.x86_64                                                                                                                                                                                3/4 
  Installing : conntrack-tools-1.4.4-7.el7.x86_64                                                                                                                                                                                       4/4 
  Verifying  : libnetfilter_cttimeout-1.0.0-7.el7.x86_64                                                                                                                                                                                1/4 
  Verifying  : libnetfilter_cthelper-1.0.0-11.el7.x86_64                                                                                                                                                                                2/4 
  Verifying  : conntrack-tools-1.4.4-7.el7.x86_64                                                                                                                                                                                       3/4 
  Verifying  : libnetfilter_queue-1.0.2-2.el7_2.x86_64                                                                                                                                                                                  4/4 

Installed:
  conntrack-tools.x86_64 0:1.4.4-7.el7                                                                                                                                                                                                      

Dependency Installed:
  libnetfilter_cthelper.x86_64 0:1.0.0-11.el7                                    libnetfilter_cttimeout.x86_64 0:1.0.0-7.el7                                    libnetfilter_queue.x86_64 0:1.0.2-2.el7_2                                   

Complete!
[root@kubemaster ~]#

다음으로 kubernetes cli command 명령어인 kubectl을 설치합니다.

[root@kubemaster minikube]# cat < /etc/yum.repos.d/kubernetes.repo 
> [kubernetes] 
> name=Kubernetes 
> baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 
> enabled=1 
> gpgcheck=1 
> repo_gpgcheck=1 
> gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg 
> EOF 
[root@kubemaster minikube]# yum install -y kubectl 
kubernetes/signature                                                                                                                                                                                                 |  454 B  00:00:00      
Retrieving key from https://packages.cloud.google.com/yum/doc/yum-key.gpg 
Importing GPG key 0xA7317B0F: 
 Userid     : "Google Cloud Packages Automatic Signing Key <gc-team@google.com>" 
 Fingerprint: d0bc 747f d8ca f711 7500 d6fa 3746 c208 a731 7b0f 
 From       : https://packages.cloud.google.com/yum/doc/yum-key.gpg 
Retrieving key from https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg 
kubernetes/signature                                                                                                                                                                                                 | 1.4 kB  00:00:00 !!!  
kubernetes/primary                                                                                                                                                                                                   |  64 kB  00:00:00      
kubernetes                                                                                                                                                                                                                          469/469 
Resolving Dependencies 
--> Running transaction check 
---> Package kubectl.x86_64 0:1.17.3-0 will be installed 
--> Finished Dependency Resolution 

Dependencies Resolved 

============================================================================================================================================================================================================================================ 
 Package                                                 Arch                                                   Version                                                    Repository                                                  Size 
============================================================================================================================================================================================================================================ 
Installing: 
 kubectl                                                 x86_64                                                 1.17.3-0                                                   kubernetes                                                 9.4 M 

Transaction Summary 
============================================================================================================================================================================================================================================ 
Install  1 Package 

Total download size: 9.4 M 
Installed size: 41 M 
Downloading packages: 
warning: /var/cache/yum/x86_64/7/kubernetes/packages/35625b6ab1da6c58ce4946742181c0dcf9ac9b6c2b5bea2c13eed4876024c342-kubectl-1.17.3-0.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 3e1ba8d5: NOKEY ] 2.7 MB/s | 8.0 MB  00:00:00 ETA  
Public key for 35625b6ab1da6c58ce4946742181c0dcf9ac9b6c2b5bea2c13eed4876024c342-kubectl-1.17.3-0.x86_64.rpm is not installed 
35625b6ab1da6c58ce4946742181c0dcf9ac9b6c2b5bea2c13eed4876024c342-kubectl-1.17.3-0.x86_64.rpm                                                                                                                         | 9.4 MB  00:00:03      
Retrieving key from https://packages.cloud.google.com/yum/doc/yum-key.gpg 
Importing GPG key 0xA7317B0F: 
 Userid     : "Google Cloud Packages Automatic Signing Key <gc-team@google.com>" 
 Fingerprint: d0bc 747f d8ca f711 7500 d6fa 3746 c208 a731 7b0f 
 From       : https://packages.cloud.google.com/yum/doc/yum-key.gpg 
Retrieving key from https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg 
Importing GPG key 0x3E1BA8D5: 
 Userid     : "Google Cloud Packages RPM Signing Key <gc-team@google.com>" 
 Fingerprint: 3749 e1ba 95a8 6ce0 5454 6ed2 f09c 394c 3e1b a8d5 
 From       : https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg 
Running transaction check 
Running transaction test 
Transaction test succeeded 
Running transaction 
  Installing : kubectl-1.17.3-0.x86_64                                                                                                                                                                                                  1/1  
  Verifying  : kubectl-1.17.3-0.x86_64                                                                                                                                                                                                  1/1  

Installed: 
  kubectl.x86_64 0:1.17.3-0                                                                                                                                                                                                                  

Complete! 
[root@kubemaster minikube]# rpm -qa | grep kubectl 
kubectl-1.17.3-0.x86_64 
[root@kubemaster minikube]# rpm -ql kubectl-1.17.3-0.x86_64 
/usr/bin/kubectl 
[root@kubemaster minikube]# cd 
[root@kubemaster ~]# vi .bash_profile 
# .bash_profile 

# Get the aliases and functions 
if [ -f ~/.bashrc ]; then 
        . ~/.bashrc 
fi 

# User specific environment and startup programs 
set -o vi 

PATH=$PATH:$HOME/bin:/usr/bin 
export PATH 

swapoff -a 
".bash_profile" 14L, 206C written 
[root@kubemaster ~]# . ./.bash_profile 
[root@kubemaster ~]# kubectl 
kubectl controls the Kubernetes cluster manager. 

 Find more information at: https://kubernetes.io/docs/reference/kubectl/overview/ 

Basic Commands (Beginner): 
  create         Create a resource from a file or from stdin. 
  expose         Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service 
  run            Run a particular image on the cluster 
  set            Set specific features on objects 

Basic Commands (Intermediate): 
  explain        Documentation of resources 
  get            Display one or many resources 
  edit           Edit a resource on the server 
  delete         Delete resources by filenames, stdin, resources and names, or by resources and label selector 

Deploy Commands: 
  rollout        Manage the rollout of a resource 
  scale          Set a new size for a Deployment, ReplicaSet or Replication Controller 
  autoscale      Auto-scale a Deployment, ReplicaSet, or ReplicationController 

Cluster Management Commands: 
  certificate    Modify certificate resources. 
  cluster-info   Display cluster info 
  top            Display Resource (CPU/Memory/Storage) usage. 
  cordon         Mark node as unschedulable 
  uncordon       Mark node as schedulable 
  drain          Drain node in preparation for maintenance 
  taint          Update the taints on one or more nodes 

Troubleshooting and Debugging Commands: 
  describe       Show details of a specific resource or group of resources 
  logs           Print the logs for a container in a pod 
  attach         Attach to a running container 
  exec           Execute a command in a container 
  port-forward   Forward one or more local ports to a pod 
  proxy          Run a proxy to the Kubernetes API server 
  cp             Copy files and directories to and from containers. 
  auth           Inspect authorization 

Advanced Commands: 
  diff           Diff live version against would-be applied version 
  apply          Apply a configuration to a resource by filename or stdin 
  patch          Update field(s) of a resource using strategic merge patch 
  replace        Replace a resource by filename or stdin 
  wait           Experimental: Wait for a specific condition on one or many resources. 
  convert        Convert config files between different API versions 
  kustomize      Build a kustomization target from a directory or a remote url. 

Settings Commands: 
  label          Update the labels on a resource 
  annotate       Update the annotations on a resource 
  completion     Output shell completion code for the specified shell (bash or zsh) 

Other Commands: 
  api-resources  Print the supported API resources on the server 
  api-versions   Print the supported API versions on the server, in the form of "group/version" 
  config         Modify kubeconfig files 
  plugin         Provides utilities for interacting with plugins. 
  version        Print the client and server version information 

Usage: 
  kubectl [flags] [options] 

Use "kubectl 

 --help" for more information about a given command. 
Use "kubectl options" for a list of global command-line options (applies to all commands). 
[root@kubemaster ~]# kubectl get nodes 
NAME         STATUS   ROLES    AGE     VERSION 
kubemaster   Ready    master   3m59s   v1.17.3 
[root@kubemaster ~]# 

먼저 Kubernetes repository를 yum repo에 추가하고, kubectl을 yum으로 설치합니다.

설치가 완료되면, kubectl을 실행하기 위해 PATH에 등록 후 kubectl get nodes를 실행하여 현재 minikube의 기동 상태를 점검합니다.

위와 같이 kubemaster node가 정상 Ready 상태로 기동되어 있는 것을 확인할 수 있습니다.

다음으로 minikube의 상태를 확인해 보겠습니다.

[root@kubemaster minikube]# ./minikube status
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
[root@kubemaster minikube]# 

./minikube status 명령어로 현재 구성 상태를 확인할 수 있으며, 모두 정상 상태입니다.

minikube를 다운시켜보겠습니다.

[root@kubemaster minikube]# ./minikube stop
* Stopping "minikube" in none ...
* "minikube" stopped.
[root@kubemaster minikube]#

위와 같이 minikube가 다운된 것을 확인할 수 있습니다.

마지막으로 minikube에 의해 구성된 설정을 모두 초기화 하기 위해서는 minikube delete 명령어를 활용할 수 있습니다.

minikube 활용

다음은 minikube가 설치되면 기본으로 포함하고 있는 kube-system의 pod입니다.

[root@kubemaster minikube]# kubectl get pods --all-namespaces
NAMESPACE     NAME                                 READY   STATUS    RESTARTS   AGE
kube-system   coredns-6955765f44-6gwhh             1/1     Running   1          23m
kube-system   coredns-6955765f44-pq8cl             1/1     Running   1          23m
kube-system   etcd-kubemaster                      1/1     Running   1          23m
kube-system   kube-apiserver-kubemaster            1/1     Running   1          23m
kube-system   kube-controller-manager-kubemaster   1/1     Running   1          23m
kube-system   kube-proxy-mqvn5                     1/1     Running   1          23m
kube-system   kube-scheduler-kubemaster            1/1     Running   1          23m
kube-system   storage-provisioner                  1/1     Running   1          23m
[root@kubemaster minikube]#

minikube에 pods 배포해 보도록 하겠습니다.

[root@kubemaster minikube]# kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
deployment.apps/hello-minikube created
[root@kubemaster minikube]# kubectl expose deployment hello-minikube --type=NodePort --port=8080
service/hello-minikube exposed
[root@kubemaster minikube]#

위는 hello-minikube라는 deployment를 생성하여, echoserver 이미지를 기동하고 8080 포트로 접근할 수 있도록 expose하는 과정입니다.

[root@kubemaster minikube]# kubectl get all
NAME                                  READY   STATUS    RESTARTS   AGE
pod/hello-minikube-797f975945-cnhq9   1/1     Running   0          3m46s

NAME                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
service/hello-minikube   NodePort    10.102.235.22   <none>        8080:30335/TCP   2m37s
service/kubernetes       ClusterIP   10.96.0.1       <none>        443/TCP          29m

NAME                             READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/hello-minikube   1/1     1            1           3m46s

NAME                                        DESIRED   CURRENT   READY   AGE
replicaset.apps/hello-minikube-797f975945   1         1         1       3m46s
[root@kubemaster minikube]# 

위와 같이 deployment로 인한 Pod와 ReplicaSet이 생성된 것을 확인할 수 있으며, 8080 포트를 expose한 Service가 생성된 것을 확인할 수 있습니다.

특정 서비스의 접근 URL을 확인하기 위해 

[root@kubemaster minikube]# ./minikube service hello-minikube --url
http://10.0.2.15:30335
[root@kubemaster minikube]# 

위와 같이 활용해 볼 수 있습니다.

[root@kubemaster minikube]# curl -v http://10.0.2.15:30335
* About to connect() to 10.0.2.15 port 30335 (#0)
*   Trying 10.0.2.15...
* Connected to 10.0.2.15 (10.0.2.15) port 30335 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 10.0.2.15:30335
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Mon, 02 Mar 2020 19:22:59 GMT
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Connection: keep-alive
< Server: echoserver
< 


Hostname: hello-minikube-797f975945-cnhq9

Pod Information:
        -no pod information available-

Server values:
        server_version=nginx: 1.13.3 - lua: 10008

Request Information:
        client_address=172.17.0.1
        method=GET
        real path=/
        query=
        request_version=1.1
        request_scheme=http
        request_uri=http://10.0.2.15:8080/

Request Headers:
        accept=*/*
        host=10.0.2.15:30335
        user-agent=curl/7.29.0

Request Body:
        -no body in request-

* Connection #0 to host 10.0.2.15 left intact
[root@kubemaster minikube]#

위와 같이 curl을 통해 호출 시 200OK를 볼 수 있습니다.

또한 다음과 같이 브라우저를 통해서도 NodePort를 통해 호출해 볼 수 있습니다.

다음으로 kubernetes 버전을 변경하여 기동하는 방법에 대해 알아보겠습니다.

기존의 v1.17.3 버전과 다르게 v1.17.0 버전을 기동해 보도록 하겠습니다.

Kubernetes 버전을 변경하여 기동하기 위해서는 먼저 기존에 설치된 v1.17.3 버전을 삭제한 후 기동해야 합니다.

[root@kubemaster minikube]# ./minikube delete
! "minikube" profile does not exist, trying anyways.
* Removed all traces of the "minikube" cluster.
[root@kubemaster minikube]# ./minikube start --kubernetes-version v1.17.0 --vm-driver none
* minikube v1.7.3 on Centos 7.6.1810
* Using the none driver based on user configuration
* Running on localhost (CPUs=2, Memory=2846MB, Disk=47073MB) ...
* OS release is CentOS Linux 7 (Core)
! Node may be unable to resolve external DNS records
* Preparing Kubernetes v1.17.0 on Docker 18.09.7 ...
* Downloading kubectl v1.17.0
* Downloading kubeadm v1.17.0
* Downloading kubelet v1.17.0
* Launching Kubernetes ... 
* Enabling addons: default-storageclass, storage-provisioner
* Configuring local host environment ...
* 
! The 'none' driver provides limited isolation and may reduce system security and reliability.
! 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
* Waiting for cluster to come online ...
* Done! kubectl is now configured to use "minikube"
[root@kubemaster minikube]# 

위와 같이 minikube delete & minikube start --kubernetes-version v1.17.0 --vm-driver none 으로 기동을 진행하고 아래와 같이 기동 상태를 확인합니다.

[root@kubemaster minikube]# kubectl get nodes
NAME         STATUS   ROLES    AGE     VERSION
kubemaster   Ready    master   3m23s   v1.17.0
[root@kubemaster minikube]# ./minikube status
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
[root@kubemaster minikube]#

다음으로 지원하는 vm-driver의 목록입니다.

- virtualbox
- vmwarefusion
- kvm2 (드라이버 설치)
- hyperkit (드라이버 설치)
- hyperv (드라이버 설치) 다음 IP는 동적이며 변경할 수 있다. minikube ip로 알아낼 수 있다.
- vmware (드라이버 설치) (VMware unified driver)
- none (쿠버네티스 컴포넌트를 가상 머신이 아닌 호스트 상에서 구동한다. 리눅스를 실행중이어야 하고, 도커(Docker)가 설치되어야 한다.)

다음으로 minikube의 대시보드를 기동해 보겠습니다.

[root@kubemaster minikube]# ./minikube dashboard
* Enabling dashboard ...
* Verifying dashboard health ...
* Launching proxy ...
* Verifying proxy health ...
http://127.0.0.1:39563/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/

기동은 위와 같이 minikube dashboard를 입력하는 것만으로 손쉽게 기동할 수 있습니다.

[root@kubemaster kubespray_kma]# curl -v http://127.0.0.1:39563/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
* About to connect() to 127.0.0.1 port 39563 (#0)
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 39563 (#0)
> GET /api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1:39563
> Accept: */*
> 
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Cache-Control: no-store
< Content-Type: text/html; charset=utf-8
< Date: Tue, 03 Mar 2020 01:00:45 GMT
< Last-Modified: Fri, 06 Dec 2019 15:14:02 GMT
< Content-Length: 1255
< 
<!--
Copyright 2017 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <title>Kubernetes Dashboard</title>
  <link rel="icon" type="image/png" href="assets/images/kubernetes-logo.png"/>
  <meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="styles.dd2d1d3576191b87904a.css"></head>

<body>
  <kd-root></kd-root>
<script src="runtime.380dd4d7ab4891f91b7b.js" defer=""></script><script src="polyfills-es5.65f1e5151c840cf04c3e.js" nomodule="" defer=""></script><script src="polyfills.8623bbc9d68876cdaaaf.js" defer=""></script><script src="scripts.7d5e232ea538f2c0f8a7.js" defer=""></script><script src="main.3036e86b43f81b098e24.js" defer=""></script></body>

</html>
* Connection #0 to host 127.0.0.1 left intact
[root@kubemaster kubespray_kma]#

결론

minikube는 multinode 환경에서 제공하는 기능은 지원하지 않습니다.

단순히 쿠버네티스 환경을 체험하고 학습하는 용도로 사용하는 것이 적합합니다.

728x90
반응형