티스토리 뷰
<참조>
https://kubernetes.io/docs/tasks/tools/install-minikube/
https://websiteforstudents.com/virtualbox-5-2-on-ubuntu-16-04-lts-server-headless/
2020년 3월 5일 추가사항 Kubernetes를 처음 스터디 하는 과정에서 실습을 위해 Minikube를 설치하게 된다. 그러나 이런 저런 이유로 설치도 다소 번거롭고 설치 후 구동이 안되는 경우도 종종 발생하게 된다. Windows 환경에서 Kubernetes 실습 환경을 구성하려는 사용자들을 대상으로 이에 대한 대안을 소개하고자 한다. |
<주의사항>
본 가이드는 필자의 개인 Wiki 상에 정리했던 글을 토대로 재 구성하여 작성되었다.
기존 터미널의 텍스트를 옮겨 편집하는 과정에서 글상자 밖으로 글이 삐져 나가는 현상이 있어서 줄 바꿈을 의도적으로 시도 하다보니, 명령어 사이이 공백이 포함된 경우 가 있음을 주의가 필요하다. 2줄 이상의 명령어로 된 부분에서만 조심하면 될 듯 하다.
여러분들이 실습을 따라하는 과정에서 단순 복붙하기 보다 한번 정도는 꼼꼼히 살피며 직접 타이핑 해 보는 것이 좋을 듯 하다.
필자가 아직 티스토리 저작도구가 익숙하지 않아 저작에 미숙하니 이점도 함께 양해 해주기를 바란다.
추가로 실습을 하다보면, time out 또는 dns resolve 등등 네트워크 관련 에러가 종종 발생한 경험이 있을 것이다.
필히 DNS 정보에 8.8.8.8 을 추가해 주자.
root@zerobig-vm:~# cat /etc/resolv.conf
nameserver 168.126.63.1
nameserver 8.8.8.8
실습환경 |
- Ubuntu16.04 on VMware® Workstation 12 Pro |
Before you begin
BIOS 에서 VT-x 또는 AMD-v 가상화를 Enabled 시켜야 한다.
우리는 Vmware 에 Ubuntu 를 설치하고 그 기반 위에 Minikube 를 설치하고 있다. 따라서 다음과 같이 Vmware 의 VM 구성 정보에서 다음을 체크해주고 구동하면 된다.
Install a Hypervisor(VirtualBox)
Hypervisor 설치가 필요하다. 여기서는 Ubuntu16.04(vmware 이미지) 에 VirtualBox5.2 설치를 기준으로 한다.
Step 1: Update Ubuntu
먼저 우분투를 업데이트 한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | root@ubuntu:/home# sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove Hit:1 https://download.docker.com/linux/ubuntu xenial InRelease Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease Hit:3 http://security.ubuntu.com/ubuntu xenial-security InRelease Hit:4 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:5 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done <중략> Found linux image: /boot/vmlinuz-4.15.0-29-generic Found initrd image: /boot/initrd.img-4.15.0-29-generic Found linux image: /boot/vmlinuz-4.13.0-45-generic Found initrd image: /boot/initrd.img-4.13.0-45-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin done Processing triggers for libc-bin (2.23-0ubuntu10) ... root@ubuntu:/home# | cs |
Step 2: Install Required Linux Headers
업데이트 완료되면 우분투 리눅스 헤더라는 것도 설치해야 한단다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | root@ubuntu:/home# sudo apt-get -y install gcc make linux-headers-$(uname -r) dkms Reading package lists... Done Building dependency tree Reading state information... Done gcc is already the newest version (4:5.3.1-1ubuntu1). make is already the newest version (4.1-6). linux-headers-4.15.0-29-generic is already the newest version (4.15.0-29.31~16.04.1). linux-headers-4.15.0-29-generic set to manually installed. The following NEW packages will be installed: dkms 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 66.3 kB of archives. After this operation, 265 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 dkms all 2.2.0.3-2ubuntu11.5 [66.3 kB] Fetched 66.3 kB in 1s (58.8 kB/s) Selecting previously unselected package dkms. (Reading database ... 216633 files and directories currently installed.) Preparing to unpack .../dkms_2.2.0.3-2ubuntu11.5_all.deb ... Unpacking dkms (2.2.0.3-2ubuntu11.5) ... Processing triggers for man-db (2.7.5-1) ... Setting up dkms (2.2.0.3-2ubuntu11.5) ... root@ubuntu:/home# | cs |
Step 3: Add VirtualBox Repository And Key
다음으로 VirtualBox repository 키를 설치한다.
1 2 3 4 5 | root@ubuntu:/home# wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - OK root@ubuntu:/home# wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - OK root@ubuntu:/home# | cs |
리파지토리를 추가한다.
1 | root@ubuntu:/home# sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list' | cs |
Step 4: Install VirtualBox
이제 VirtualBox5.2를 설치하고 제대로 설치되었나 검증한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | root@ubuntu:/home# sudo apt-get update Get:1 http://download.virtualbox.org/virtualbox/debian xenial InRelease [7,883 B] Hit:2 https://download.docker.com/linux/ubuntu xenial InRelease Hit:3 http://us.archive.ubuntu.com/ubuntu xenial InRelease Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease Hit:5 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:6 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease Get:7 http://download.virtualbox.org/virtualbox/debian xenial/contrib amd64 Packages [1,762 B] Get:8 http://download.virtualbox.org/virtualbox/debian xenial/contrib i386 Packages [1,780 B] Fetched 11.4 kB in 1s (5,765 B/s) Reading package lists... Done root@ubuntu:/home# sudo apt-get install virtualbox-5.2 Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libsdl-ttf2.0-0 libsdl1.2debian The following NEW packages will be installed: libsdl-ttf2.0-0 libsdl1.2debian virtualbox-5.2 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 73.6 MB of archives. After this operation, 188 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libsdl1.2debian amd64 1.2.15+dfsg1-3 [168 kB] Get:2 http://download.virtualbox.org/virtualbox/debian xenial/contrib amd64 virtualbox-5.2 amd64 5.2.16-123759~Ubuntu~xenial [73.5 MB] Get:3 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 libsdl-ttf2.0-0 amd64 2.0.11-3 [15.0 kB] Fetched 73.6 MB in 6s (10.8 MB/s) Preconfiguring packages ... Selecting previously unselected package libsdl1.2debian:amd64. (Reading database ... 216681 files and directories currently installed.) Preparing to unpack .../libsdl1.2debian_1.2.15+dfsg1-3_amd64.deb ... Unpacking libsdl1.2debian:amd64 (1.2.15+dfsg1-3) ... Selecting previously unselected package libsdl-ttf2.0-0:amd64. Preparing to unpack .../libsdl-ttf2.0-0_2.0.11-3_amd64.deb ... Unpacking libsdl-ttf2.0-0:amd64 (2.0.11-3) ... Selecting previously unselected package virtualbox-5.2. Preparing to unpack .../virtualbox-5.2_5.2.16-123759~Ubuntu~xenial_amd64.deb ... Unpacking virtualbox-5.2 (5.2.16-123759~Ubuntu~xenial) ... Processing triggers for libc-bin (2.23-0ubuntu10) ... Processing triggers for systemd (229-4ubuntu21.4) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for hicolor-icon-theme (0.15-0ubuntu1.1) ... Processing triggers for shared-mime-info (1.5-2ubuntu0.2) ... Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ... Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ... Processing triggers for mime-support (3.59ubuntu1) ... Setting up libsdl1.2debian:amd64 (1.2.15+dfsg1-3) ... Setting up libsdl-ttf2.0-0:amd64 (2.0.11-3) ... Setting up virtualbox-5.2 (5.2.16-123759~Ubuntu~xenial) ... Adding group `vboxusers' (GID 129) ... Done. Processing triggers for libc-bin (2.23-0ubuntu10) ... root@ubuntu:/home# VBoxManage -v 5.2.16r123759 | cs |
Step 5: Install VirtualBox Extension Pack
기본 설치에 더불어 확장팩을 설치한다. VRDP (Virtual Remote Desktop Protocol) 과 다른 강화된 기능을 이용 가능케 해준다고 한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | root@ubuntu:/home# curl -O http://download.virtualbox.org/virtualbox/5.2.4/Oracle_VM_VirtualBox_Extension_Pack-5.2.4-119785.vbox-extpack % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 18.5M 100 18.5M 0 0 1405k 0 0:00:13 0:00:13 --:--:-- 1630k root@ubuntu:/home# sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.4-119785.vbox-extpack 119785.vbox-extpack VirtualBox Extension Pack Personal Use and Evaluation License (PUEL) License version 10, 20 July 2017 <중략> Do you agree to these license terms and conditions (y/n)? y License accepted. For batch installaltion add --accept-license=56be48f923303c8cababb0bb4c478284b688ed23f16d775d729b89a2e8e5f9eb to the VBoxManage command line. 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Successfully installed "Oracle VM VirtualBox Extension Pack". | cs |
확장팩의 내용을 출력해 본다.
1 2 3 4 5 6 7 8 9 10 11 12 13 | root@ubuntu:/home# VBoxManage list extpacks Extension Packs: 1 Pack no. 0: Oracle VM VirtualBox Extension Pack Version: 5.2.4 Revision: 119785 Edition: Description: USB 2.0 and USB 3.0 Host Controller, Host Webcam, VirtualBox RDP, PXE ROM, Disk Encryption, NVMe. VRDE Module: VBoxVRDP Usable: true Why unusable: root@ubuntu:/home# | cs |
이제 ,VirtualBox 를 즐겨보자~
Install kubectl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | root@ubuntu:/home# sudo apt-get update && sudo apt-get install -y apt-transport-https Hit:1 http://download.virtualbox.org/virtualbox/debian xenial InRelease Hit:2 https://download.docker.com/linux/ubuntu xenial InRelease Hit:3 http://us.archive.ubuntu.com/ubuntu xenial InRelease Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB] Get:6 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB] Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB] Get:7 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [820 kB] Get:8 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [748 kB] Get:9 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [675 kB] Get:10 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [616 kB] Fetched 1,877 kB in 8s (212 kB/s) Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done apt-transport-https is already the newest version (1.2.27). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. root@ubuntu:/home# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - OK root@ubuntu:/home# sudo touch /etc/apt/sources.list.d/kubernetes.list root@ubuntu:/home# echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list deb http://apt.kubernetes.io/ kubernetes-xenial main root@ubuntu:/home# sudo apt-get update Hit:1 http://download.virtualbox.org/virtualbox/debian xenial InRelease Hit:2 https://download.docker.com/linux/ubuntu xenial InRelease Hit:3 http://us.archive.ubuntu.com/ubuntu xenial InRelease Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB] Hit:6 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease Get:7 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB] Get:5 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8,993 B] 94% [Working]sudo apt-get install -y kubectl Get:8 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages [18.6 kB] Fetched 241 kB in 6s (40.0 kB/s) Reading package lists... Done root@ubuntu:/home# sudo apt-get install -y kubectl Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: kubectl 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 9,388 kB of archives. After this operation, 55.4 MB of additional disk space will be used. Get:1 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubectl amd64 1.11.1-00 [9,388 kB] Fetched 9,388 kB in 11s (816 kB/s) Selecting previously unselected package kubectl. (Reading database ... 217534 files and directories currently installed.) Preparing to unpack .../kubectl_1.11.1-00_amd64.deb ... Unpacking kubectl (1.11.1-00) ... Setting up kubectl (1.11.1-00) ... root@ubuntu:/home# kubectl version Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"b1b29978270dc22fecc592ac55d903350454310a", GitTreeState:"clean", BuildDate:"2018-07-17T18:53:20Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"} The connection to the server localhost:8080 was refused - did you specify the right host or port? root@ubuntu:/home# root@ubuntu:/home# root@ubuntu:/home# kubectl cluster-info Kubernetes master is running at http://localhost:8080 To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. The connection to the server localhost:8080 was refused - did you specify the right host or port? root@ubuntu:/home# | cs |
Install Minikube
1 2 3 4 5 6 | root@ubuntu:/home# curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 38.5M 100 38.5M 0 0 964k 0 0:00:40 0:00:40 --:--:-- 1008k root@ubuntu:/home# | cs |
Run Your Minikube
Minikube 를 구동시킨다. (오래 걸린다... 약 7~8분? 잠시 머리 식히다고 오면 될 듯...)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | root@ubuntu:/home# minikube start Starting local Kubernetes v1.10.0 cluster... Starting VM... Downloading Minikube ISO 160.27 MB / 160.27 MB [============================================] 100.00% 0s Getting VM IP address... Moving files into cluster... Downloading kubelet v1.10.0 Downloading kubeadm v1.10.0 Finished Downloading kubeadm v1.10.0 Finished Downloading kubelet v1.10.0 Setting up certs... Connecting to cluster... Setting up kubeconfig... Starting cluster components... Kubectl is now configured to use the cluster. Loading cached images from config file. root@ubuntu:/home# | cs |
1 2 3 4 5 6 | root@ubuntu:/home# minikube version minikube version: v0.30.0 root@ubuntu:/home# minikube status minikube: Running cluster: Running kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100 | cs |
자~~ 이제 제로빅과 함께 본격적인 Kubernetes 실습으로 들어가 보자~~^
'Kubernetes' 카테고리의 다른 글
05 Kubernetes Basics - Using Minikube to Create a Cluster (0) | 2018.08.19 |
---|---|
04 Kubernetes Basics - Overview (0) | 2018.08.19 |
03 Hello Minikube (2) | 2018.08.16 |
01 Minikube 설치 on CentOS7.5 (5) | 2018.08.15 |
00 제로빅의 Kubernetes(쿠버네티스) Tutorial 실습기 (0) | 2018.08.15 |