쿠버네티스

[쿠버네티스] 단일노드에 MiniKube 환경 구축 하기

트리스탄1234 2024. 3. 4. 05:21
728x90
반응형

안녕하세요 이웃님들 ^.^
좋은 아침 입니다.
 
오늘은 단일 Node에 Minikube를 설치하고 Kubernetis 실습 환경을 구축 하는 
방법에 대해서 포스팅 해보겠습니다. 본 절차는 ubuntu 기준으로 구성이 되었습니다.
 
1.Minikube 설치 하기
Minikube는 Kubernetis 환경 간다히 만들수 있는 tool입니다. 
그럼 아래 절차를 통해 Minukube를 설치를 해보겠습니다.
   1) tool의 버전을 아래 명령을 통해 업데이트를 진행 합니다.

ubuntu@ip-172-31-31-84:~$ sudo apt-get update
Hit:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease
Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:5 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [3129 kB]
Get:6 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1170 kB]
Fetched 4527 kB in 1s (3739 kB/s)
Reading package lists... Done
반응형

2) 아래 명령으로 conntrack를 설치를 합니다. 
    sudo apt-get install conntrack

ubuntu@ip-172-31-31-84:~$ sudo apt-get install conntrack
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  nftables
The following NEW packages will be installed:
  conntrack
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 30.3 kB of archives.
After this operation, 104 kB of additional disk space will be used.
Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal/main amd64 conntrack amd64 1:1.4.5-2 [30.3 kB]
Fetched 30.3 kB in 0s (1965 kB/s)
Selecting previously unselected package conntrack.
(Reading database ... 62027 files and directories currently installed.)
Preparing to unpack .../conntrack_1%3a1.4.5-2_amd64.deb ...
Unpacking conntrack (1:1.4.5-2) ...
Setting up conntrack (1:1.4.5-2) ...
Processing triggers for man-db (2.9.1-1) ...

 

3) 아래 명령을 통해 minikube를 다운로드를 하고 설치하고 minikube를 시작 합니다.
  curl -LO https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-linux-amd64
  sudo install minikube-linux-amd64 /usr/local/bin/minikube
  minikube start --driver=none --kubernetes-version=v1.23.0 --addons=ingress,metrics-server
 

ubuntu@ip-172-31-31-84:~$ curl -LO https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-linux-amd64
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 73.1M  100 73.1M    0     0   199M      0 --:--:-- --:--:-- --:--:--  199M
ubuntu@ip-172-31-31-84:~$ sudo install minikube-linux-amd64 /usr/local/bin/minikube

ubuntu@ip-172-31-31-84:~$ minikube start --driver=none --kubernetes-version=v1.23.0 --addons=ingress,metrics-server
* minikube v1.28.0 on Ubuntu 20.04
* Using the none driver based on user configuration
* Starting control plane node minikube in cluster minikube
* Running on localhost (CPUs=2, Memory=7836MB, Disk=29587MB) ...
* minikube 1.32.0 is available! Download it: https://github.com/kubernetes/minikube/releases/tag/v1.32.0
* To disable this notice, run: 'minikube config set WantUpdateNotification false'

! StartHost failed, but will try again: creating host: create: precreate: exec: "docker": executable file not found in $PATH
* Running on localhost (CPUs=2, Memory=7836MB, Disk=29587MB) ...
* Failed to start none bare metal machine. Running "minikube delete" may fix it: creating host: create: precreate: exec: "docker": executable file not found in $PATH

X Exiting due to GUEST_PROVISION: Failed to start host: creating host: create: precreate: exec: "docker": executable file not found in $PATH
*
╭─────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                             │
│    * If the above advice does not help, please let us know:                                 │
│      https://github.com/kubernetes/minikube/issues/new/choose                               │
│                                                                                             │
│    * Please run `minikube logs --file=logs.txt` and attach logs.txt to the GitHub issue.    │
│                                                                                             │
╰─────────────────────────────────────────────────────────────────────────────────────────────╯

 
2. Kubectl을 설치 합니다.
  1) 아래 명령을 통해 kubectl을 다운받고 설치를 진행 합니다. 
curl -LO https://dl.k8s.io/release/v1.23.0/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

ubuntu@ip-172-31-31-84:~$ curl -LO https://dl.k8s.io/release/v1.23.0/bin/linux/amd64/kubectl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   138  100   138    0     0   2875      0 --:--:-- --:--:-- --:--:--  2875
100 44.4M  100 44.4M    0     0  33.7M      0  0:00:01  0:00:01 --:--:-- 35.2M
ubuntu@ip-172-31-31-84:~$
ubuntu@ip-172-31-31-84:~$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
ubuntu@ip-172-31-31-84:~$

 2) kubectl version을 확인 합니다.
 kubectl version --output yaml

ubuntu@ip-172-31-31-84:~$ kubectl version --output yaml
clientVersion:
  buildDate: "2021-12-07T18:16:20Z"
  compiler: gc
  gitCommit: ab69524f795c42094a6630298ff53f3c3ebab7f4
  gitTreeState: clean
  gitVersion: v1.23.0
  goVersion: go1.17.3
  major: "1"
  minor: "23"
  platform: linux/amd64

The connection to the server localhost:8080 was refused - did you specify the right host or port?
ubuntu@ip-172-31-31-84:~$

3) Bash 자동 완성 기능을 위해 아래와 같이 설정을 합니다.

ubuntu@ip-172-31-23-60:~$ echo 'source <(kubectl completion bash)' >>~/.bashrc
ubuntu@ip-172-31-23-60:~$ echo 'alias k=kubectl' >>~/.bashrc
ubuntu@ip-172-31-23-60:~$ echo 'complete -o default -F __start_kubectl k' >>~/.bashrc
ubuntu@ip-172-31-23-60:~$ exec bash

 
3. Helm을 설치 합니다.
Helm은 Kubernetis의 Resource를 한번에 설치 할수 있는 패키지 매니지먼트 Tool 입니다.
1) 아래 명령을 통해 Helm을 설치를 합니다.
curl -LO https://get.helm.sh/helm-v3.11.0-linux-amd64.tar.gz
tar -zxvf helm-v3.11.0-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm

ubuntu@ip-172-31-31-84:~$ curl -LO https://get.helm.sh/helm-v3.11.0-linux-amd64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14.3M  100 14.3M    0     0  39.6M      0 --:--:-- --:--:-- --:--:-- 39.6M
ubuntu@ip-172-31-31-84:~$ tar -zxvf helm-v3.11.0-linux-amd64.tar.gz
linux-amd64/
linux-amd64/helm
linux-amd64/LICENSE
linux-amd64/README.md
ubuntu@ip-172-31-31-84:~$
ubuntu@ip-172-31-31-84:~$ sudo mv linux-amd64/helm /usr/local/bin/helm

 
2) Helm 버전을 아래 명령을 통해 확인 합니다.

ubuntu@ip-172-31-31-84:~$ helm version
version.BuildInfo{Version:"v3.11.0", GitCommit:"472c5736ab01133de504a826bd9ee12cbe4e7904", GitTreeState:"clean", GoVersion:"go1.18.10"}
ubuntu@ip-172-31-31-84:~$

 
이제 한개의 Node에서 Kubernetis 환경을 모두 설치를 했습니다.
그럼 원하시는 시험을 진행 하시면 됩니다.
 

728x90
반응형