본문 바로가기
IT 기타/Docker-K8S

Minikube 설치 및 예제

by 빅경 2024. 8. 23.
728x90
반응형

Minikube는 로컬 Kubernetes 클러스터를 설정하는 도구로, 개발자와 Kubernetes 사용자들이 쉽게 사용할 수 있도록 설계되었습니다. 

Mac PC에서 Lima환경(Linux)에서 Minikube를 설치하였습니다.

https://kubernetes.io/ko/docs/tutorials/hello-minikube/

 

Hello Minikube

이 튜토리얼에서는 Minikube와 Katacoda를 이용하여 쿠버네티스에서 샘플 애플리케이션을 어떻게 실행하는지 살펴본다. Katacode는 무료로 브라우저에서 쿠버네티스 환경을 제공한다. 참고:로컬에서 M

kubernetes.io

 

Minikube 설치

https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Fx86-64%2Fstable%2Fbinary+download

macOS를 사용해서 다음과 같이 선택하였습니다.

 

minikube start

minikube is local Kubernetes, focusing on making it easy to learn and develop for Kubernetes. All you need is Docker (or similarly compatible) container or a Virtual Machine environment, and Kubernetes is a single command away: minikube start What you’ll

minikube.sigs.k8s.io

 

 

설치를 완료하면 minikube start합니다.



다음 명령어로 kubectl 명령어를 사용할 수 있습니다.
minikube kubectl -- get po -A

alias를 등록해서 사용 가능합니다.
alias kubectl="minikube kubectl --"

minikube는 Kubernetes 대시보드를 번들로 제공합니다.
minikube dashboard

 

Applications 배포
Service
Create a sample deployment and expose it on port 8080:

  • kubectl create deployment hello-minikube --image=kicbase/echo-server:1.0
  • kubectl expose deployment hello-minikube --type=NodePort --port=8080

It may take a moment, but your deployment will soon show up when you run:

  • kubectl get services hello-minikube

The easiest way to access this service is to let minikube launch a web browser for you:

  • minikube service hello-minikube

Alternatively, use kubectl to forward the port:

  • kubectl port-forward service/hello-minikube 7080:8080

Tada! Your application is now available at http://localhost:7080/.


Cluster 관리 명령어

Pause Kubernetes without impacting deployed applications:

  • minikube pause

Unpause a paused instance:

  • minikube unpause

Halt the cluster:

  • minikube stop

Change the default memory limit (requires a restart):

  • minikube config set memory 9001

Browse the catalog of easily installed Kubernetes services:

  • minikube addons list

Create a second cluster running an older Kubernetes release:

  • minikube start -p aged --kubernetes-version=v1.16.1

Delete all of the minikube clusters:

  • minikube delete --all
728x90
반응형