vagrant 를 이용한 K8S 구성
이 블로그 포스트는 인프런 의 대세는 쿠버네티스 [초급~중급] 강의를 내가 이해하기 편하도록
정리한 자료이다.
대세는 쿠버네티스 [초급~중급] - 인프런 | 강의
쿠버네티스는 앞으로 어플리케이션 배포/운영에 주류가 될 기술 입니다. 이 강좌를 통해 여러분도 대세에 쉽게 편승할 수 있게 됩니다., - 강의 소개 | 인프런...
www.inflearn.com
1. vagrant 다운로드
https://www.vagrantup.com/downloads
Install | Vagrant | HashiCorp Developer
Explore Vagrant product documentation, tutorials, and examples.
developer.hashicorp.com
위 URL 에서 vagrant 를 다운받은 후 실행하여 설치한다.
2. Virtual BOX 설치
https://www.virtualbox.org/wiki/Downloads
Downloads – Oracle VM VirtualBox
Download VirtualBox Here you will find links to VirtualBox binaries and its source code. VirtualBox binaries By downloading, you agree to the terms and conditions of the respective license. If you're looking for the latest VirtualBox 6.1 packages, see Virt
www.virtualbox.org
위 URL 에서 virtual box 를 다운받아 설치한다.
3. k8s 이미지 디렉토리 생성
특정경로에 디렉토리를 생성한다.
이번 설치 테스트에서는 D:\var_k8s 경로를 사용한다.
4. vagrant 파일 다운로드
윈도우의 CMD 창에서 실행한다.
C:\Users\User>d: D:\>cd var_k8s D:\>curl -O https://kubetm.github.io/yamls/k8s-install/Vagrantfile |
5. vagrant 실행
curl 명령어로 Vagrantfile 이 다운받아졌다면 vagrant 를 실행한다.
D:\var_k8s>vagrant up |
vagrant 를 통해 이미지 생성 및 yum update, docker, kubeadm 설치 등이 진행된다.
ETC. vagrant 명령어
vagrant up : 가상머신 기동 vagrant halt : 가상머신 Shutdown vagrant ssh : 가상머신 접속 (vagrant ssh k8s-master) vagrant destroy : 가상머신 삭제 |
6. 가상머신 접속
생성이 완료되면 ssh 툴을 이용하여 서버에 접속한다.
k8smaster : 192.168.56.30
k8s-node1 : 192.168.56.31
k8s-node2 : 192.168.56.32
ID : root
PW : vagrant
7. K8s Node 연결
Master 서버에서 token 정보 확인
node1, node2에 master 서버에서 확인한 내용을 실행한다.
연결된 정보 확인
8. 대시보드 접속
http://192.168.56.30:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/workloads?namespace=default
ETC. 재기동시 master node 작업
master node 재기동시 대시보드 접속을 위해 proxy 오픈
nohup kubectl proxy --port=8001 --address=192.168.56.30 --accept-hosts='^*$' >/dev/null 2>&1 & |