공식 문서에서 사용되는 port에 대한 목록을 확인 할 수 있다. -> microk8s required ports
Master에 연결되는 SG는 위의 port들에 22, 80, 443 port까지 추가되어 open시켜놓았다.
docker & docker-compose install
sudo apt-get update -y &&\
apt-transport-https &&\
ca-certificates &&\
curl &&\
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install -y docker-ce
sudo usermod -aG docker $USER
# install docker-compose
sudo apt-get install docker-compose-plugin
microk8s install
sudo apt update
# hostname change
sudo hostnamectl set-hostname master
# microk8s install
sudo snap install microk8s --classic --channel=1.28
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
sudo su - $USER
# additional service install
microk8s enable dashboard
microk8s enable dns
microk8s enable registry
microk8s enable istio
# alias 설정
{
echo alias kc="'microk8s kubectl'"
echo alias kcd="'microk8s kubectl describe'"
} >> ~/.bashrc
source ~/.bashrc
master node 확인
kc get nodes
master server에서 ssh를 통해 worker server에 접속
sudo ssh ubuntu@[worker internal IP] -i [key.pem]
docker & docker-compose install
sudo apt-get update -y &&\
apt-transport-https &&\
ca-certificates &&\
curl &&\
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install -y docker-ce
sudo usermod -aG docker $USER
# install docker-compose
sudo apt-get install docker-compose-plugin
microk8s install
sudo apt update
# hostname change
sudo hostnamectl set-hostname node1
# microk8s install
sudo snap install microk8s --classic --channel=1.28
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
sudo su - $USER
microk8s add-node
위 command를 입력하면 아래와 같은 문장들이 출력된다.
From the node you wish to join to this cluster, run the following:
microk8s join 10.0.0.10:25000/fdcb6153fe7321e0418d569514daa83b/b312fd124686
Use the '--worker' flag to join a node as a worker not running the control plane, eg:
microk8s join 10.0.0.10:25000/fdcb6153fe7321e0418d569514daa83b/b312fd124686 --worker
If the node you are adding is not reachable through the default interface you can use one of the following:
microk8s join 10.0.0.10:25000/fdcb6153fe7321e0418d569514daa83b/b312fd124686
microk8s join 172.17.0.1:25000/fdcb6153fe7321e0418d569514daa83b/b312fd124686
이 중 'microk8s join 10.0.0.10:25000/ ~ ~ ~ ~ / ~ ~ ~ ~ --worker' 명령을 worker node에 입력해주면 된다.
sudo microk8s join 10.0.0.10:25000/fdcb6153fe7321e0418d569514daa83b/b312fd124686 --worker
Master Node Role Labeling
kc label node [MASTER HOSTNAME] node-role.kubernetes.io/master=master
Worker Node Role Labeling
kc label node [WORKER HOSTNAME] node-role.kubernetes.io/worker1=worker