본문 바로가기
devops/Kubernetes

kubernetes minikube install

by 아이티.파머 2024. 4. 25.
반응형

minikube

쿠버네티스를 로컬에서 실행하려면 master node 와 slive node를 구성해야 하는데 이는 많은 비용이 들기때문에 간단하게 로컬에서 구성해 볼수있는 시스템이 있다. 이것이 바로 minikube 이다.

현업에서 실제 운영할때는 minikube를 구성하여 사용하지 않고 kubeadm 을 이용하여 구축한다고 한다. minikube는 학습용으로 쿠버네티스를 쉽게 배우고 개발 할 수 있도록 하는데 중점을 둔 로컬 쿠버네티스이다.

minikube 설치

ezzo-skan@mezzoui-MacBookPro utility % **brew install minikube**
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
==> Updated Homebrew from 3.5.8 (402e267a0) to 3.6.20 (b3a71ba7c).
Updated 1 tap (adoptopenjdk/openjdk).

You have 18 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.

The 3.6.0 release notes are available on the Homebrew Blog:
  https://brew.sh/blog/3.6.0
The 3.6.20 changelog can be found at:
  https://github.com/Homebrew/brew/releases/tag/3.6.20
==> Fetching dependencies for minikube: kubernetes-cli
==> Fetching kubernetes-cli
==> Downloading https://ghcr.io/v2/homebrew/core/kubernetes-cli/manifests/1.26.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/kubernetes-cli/blobs/sha256:e421cee1a3cbf04cc5f7e95f1905c461a919dea708fcfe1c1fc4761eea6ddc74
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:e421cee1a3cbf04cc5f7e95f1905c461a919dea708fcfe1c1fc4761eea6ddc74?se=202
######################################################################## 100.0%
==> Fetching minikube
==> Downloading https://ghcr.io/v2/homebrew/core/minikube/manifests/1.29.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/minikube/blobs/sha256:9d1cbc391cf6a913c8f1c3b8c2450c5abfacaefae86afe4092cddf7dab495bc3
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:9d1cbc391cf6a913c8f1c3b8c2450c5abfacaefae86afe4092cddf7dab495bc3?se=202
######################################################################## 100.0%
==> Installing dependencies for minikube: kubernetes-cli
==> Installing minikube dependency: kubernetes-cli
==> Pouring kubernetes-cli--1.26.1.monterey.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/kubectl
Target /usr/local/bin/kubectl
already exists. You may want to remove it:
  rm '/usr/local/bin/kubectl'

To force the link and overwrite all conflicting files:
  brew link --overwrite kubernetes-cli

To list all files that would be deleted:
  brew link --overwrite --dry-run kubernetes-cli

Possible conflicting files are:
/usr/local/bin/kubectl -> /Applications/Docker.app/Contents/Resources/bin/kubectl
==> Summary
🍺  /usr/local/Cellar/kubernetes-cli/1.26.1: 231 files, 57.8MB
==> Installing minikube
==> Pouring minikube--1.29.0.monterey.bottle.tar.gz
==> Caveats
zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/minikube/1.29.0: 9 files, 78.4MB
==> Running `brew cleanup minikube`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/mezzo-skan/Library/Caches/Homebrew/tree--2.0.2... (53KB)
Removing: /Users/mezzo-skan/Library/Caches/Homebrew/descriptions.json... (345.7KB)
Removing: /Users/mezzo-skan/Library/Caches/Homebrew/cask_descriptions.json... (266KB)
Removing: /Users/mezzo-skan/Library/Caches/Homebrew/portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz... (8.8MB)
Removing: /Users/mezzo-skan/Library/Caches/Homebrew/tree_bottle_manifest--2.0.2... (6.2KB)
Removing: /Users/mezzo-skan/Library/Caches/Homebrew/Cask/qview--5.0.dmg... (27.2MB)
Removing: /Users/mezzo-skan/Library/Caches/Homebrew/Cask/adoptopenjdk8--8,292:b10.pkg... (103.3MB)
==> Caveats
==> minikube
zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

이전에 docker 설치와 kubernetes 를 활성화 해두어 중간에 kubectl 설치시 에러가 난게 보인다. 이부분은 무시해도 된다.

mezzo-skan@mezzoui-MacBookPro utility % docker ps
CONTAINER ID   IMAGE                                 COMMAND                  CREATED         STATUS         PORTS                                                                                                                                  NAMES
77eaf95fb82e   gcr.io/k8s-minikube/kicbase:v0.0.37   "/usr/local/bin/entr…"   5 minutes ago   Up 5 minutes   127.0.0.1:50805->22/tcp, 127.0.0.1:50806->2376/tcp, 127.0.0.1:50808->5000/tcp, 127.0.0.1:50809->8443/tcp, 127.0.0.1:50807->32443/tcp   minikube

현재 동작중인 minikube 를 확이 할 수 있다.

minikube start

mezzo-skan@mezzoui-MacBookPro utility % **minikube start**
😄  Darwin 12.5.1 의 minikube v1.29.0
✨  자동적으로 docker 드라이버가 선택되었습니다. 다른 드라이버 목록: parallels, vmware, virtualbox, ssh
📌  Using Docker Desktop driver with root privileges
👍  minikube 클러스터의 minikube 컨트롤 플레인 노드를 시작하는 중
🚜  베이스 이미지를 다운받는 중 ...
💾  쿠버네티스 v1.26.1 을 다운로드 중 ...
    > preloaded-images-k8s-v18-v1...:  397.05 MiB / 397.05 MiB  100.00% 2.30 Mi
    > gcr.io/k8s-minikube/kicbase...:  407.19 MiB / 407.19 MiB  100.00% 1.91 Mi
🔥  Creating docker container (CPUs=2, Memory=7911MB) ...
🐳  쿠버네티스 v1.26.1 을 Docker 20.10.23 런타임으로 설치하는 중
    ▪ 인증서 및 키를 생성하는 중 ...
    ▪ 컨트롤 플레인이 부팅...
    ▪ RBAC 규칙을 구성하는 중 ...
🔗  Configuring bridge CNI (Container Networking Interface) ...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🔎  Kubernetes 구성 요소를 확인...
🌟  애드온 활성화 : storage-provisioner, default-storageclass

❗  /usr/local/bin/kubectl is version 1.21.4, which may have incompatibilities with Kubernetes 1.26.1.
    ▪ Want kubectl v1.26.1? Try 'minikube kubectl -- get pods -A'
🏄  끝났습니다! kubectl이 "minikube" 클러스터와 "default" 네임스페이스를 기본적으로 사용하도록 구성되었습니다.
mezzo-skan@mezzoui-MacBookPro utility %

이제 미니쿠버를 설치하고 활성화 했음으로 kubectl 명령어를 이용하여 pod를 생성하고 서비스해 볼수있는 환경이 갖춰졌다.

dashboard 활성화

mezzo-skan@mezzoui-MacBookPro utility % **minikube dashboard**
🔌  대시보드를 활성화하는 중 ...
    ▪ Using image docker.io/kubernetesui/metrics-scraper:v1.0.8
    ▪ Using image docker.io/kubernetesui/dashboard:v2.7.0
💡  Some dashboard features require the metrics-server addon. To enable all features please run:

    minikube addons enable metrics-server    

🤔  Verifying dashboard health ...
🚀  프록시를 시작하는 중 ...
🤔  Verifying proxy health ...
🎉  Opening http://127.0.0.1:51275/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...

minikube에 addon 되어 있는 plugin 목록

mezzo-skan@mezzoui-MacBookPro ~ % minikube addons list
|-----------------------------|----------|--------------|--------------------------------|
|         ADDON NAME          | PROFILE  |    STATUS    |           MAINTAINER           |
|-----------------------------|----------|--------------|--------------------------------|
| ambassador                  | minikube | disabled     | 3rd party (Ambassador)         |
| auto-pause                  | minikube | disabled     | Google                         |
| cloud-spanner               | minikube | disabled     | Google                         |
| csi-hostpath-driver         | minikube | disabled     | Kubernetes                     |
| dashboard                   | minikube | enabled ✅   | Kubernetes                     |
| default-storageclass        | minikube | enabled ✅   | Kubernetes                     |
| efk                         | minikube | disabled     | 3rd party (Elastic)            |
| freshpod                    | minikube | disabled     | Google                         |
| gcp-auth                    | minikube | disabled     | Google                         |
| gvisor                      | minikube | disabled     | Google                         |
| headlamp                    | minikube | disabled     | 3rd party (kinvolk.io)         |
| helm-tiller                 | minikube | disabled     | 3rd party (Helm)               |
| inaccel                     | minikube | disabled     | 3rd party (InAccel             |
|                             |          |              | [info@inaccel.com])            |
| ingress                     | minikube | disabled     | Kubernetes                     |
| ingress-dns                 | minikube | disabled     | Google                         |
| istio                       | minikube | disabled     | 3rd party (Istio)              |
| istio-provisioner           | minikube | disabled     | 3rd party (Istio)              |
| kong                        | minikube | disabled     | 3rd party (Kong HQ)            |
| kubevirt                    | minikube | disabled     | 3rd party (KubeVirt)           |
| logviewer                   | minikube | disabled     | 3rd party (unknown)            |
| metallb                     | minikube | disabled     | 3rd party (MetalLB)            |
| metrics-server              | minikube | disabled     | Kubernetes                     |
| nvidia-driver-installer     | minikube | disabled     | Google                         |
| nvidia-gpu-device-plugin    | minikube | disabled     | 3rd party (Nvidia)             |
| olm                         | minikube | disabled     | 3rd party (Operator Framework) |
| pod-security-policy         | minikube | disabled     | 3rd party (unknown)            |
| portainer                   | minikube | disabled     | 3rd party (Portainer.io)       |
| registry                    | minikube | disabled     | Google                         |
| registry-aliases            | minikube | disabled     | 3rd party (unknown)            |
| registry-creds              | minikube | disabled     | 3rd party (UPMC Enterprises)   |
| storage-provisioner         | minikube | enabled ✅   | Google                         |
| storage-provisioner-gluster | minikube | disabled     | 3rd party (Gluster)            |
| volumesnapshots             | minikube | disabled     | Kubernetes                     |
|-----------------------------|----------|--------------|--------------------------------|
mezzo-skan@mezzoui-MacBookPro ~ %

minikube 에 addon 되어 있는 기능을 enable/disable 시킬수있다.

minikube addos enable{disable} {addon-name}

minikubu 중지

mezzo-skan@mezzoui-MacBookPro spring-cloud-template-test % minikube stop
✋  "minikube" 노드를 중지하는 중 ...
🛑  "minikube"를 SSH로 전원을 끕니다 ...
🛑  1개의 노드가 중지되었습니다.

minikubu 시작 중지 명령어

minikube stop
**minikube start
minikube dashboard**

Hello Minikube

 

반응형

'devops > Kubernetes' 카테고리의 다른 글

kubernetes namespage  (0) 2024.04.25
kubernetes service (nodeport) 에대한 설명  (1) 2024.04.25
kubernetes dashboard  (1) 2024.04.25
kubectl 명령어  (0) 2024.04.25
Argo CD 설치하기, Argo CD 란?  (0) 2023.04.28