1. swapoff
sudo swapoff -a
sudo sed -i '/ swap / s/^/#/' /etc/fstab
sudo systemctl mask dev-sda3.swap
sudo reboot
2. ssh 인증키 생성 (아래 명령을 치고 입력없이 enter 만 쳐서 만듭니다.)
ssh-keygen -t rsa
3. 인증키 내용 authorized_keys 파일에 넣고 생성
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
4. kubespray clone
git clone https://github.com/kubernetes-sigs/kubespray.git -b v2.17.1
5. 파이썬 설치
sudo apt update
sudo apt install -y python3-pip
6. 필수항목 설치
cd kubespray/
sudo pip3 install -r requirements.txt
7. node 설정 (master node 만 있는 상태)
: inventory/sample 에는 inventory.ini 샘플 파일이 있어 copy 해주고 수정합니다.
cp -r inventory/sample inventory/mycluster
vi inventory/mycluster/inventory.ini
# ## Configure 'ip' variable to bind kubernetes services on a
# ## different ip than the default iface
# ## We should set etcd_member_name for etcd cluster. The node that is not a etcd member do not need to set the value, or can set the empty string value.
[all]
master ansible_host=192.168.0.92 ip=192.168.0.92 etcd_member_name=etcd1
# node2 ansible_host=95.54.0.13 # ip=10.3.0.2 etcd_member_name=etcd2
# node3 ansible_host=95.54.0.14 # ip=10.3.0.3 etcd_member_name=etcd3
# node4 ansible_host=95.54.0.15 # ip=10.3.0.4 etcd_member_name=etcd4
# node5 ansible_host=95.54.0.16 # ip=10.3.0.5 etcd_member_name=etcd5
# node6 ansible_host=95.54.0.17 # ip=10.3.0.6 etcd_member_name=etcd6
# ## configure a bastion host if your nodes are not directly reachable
# [bastion]
# bastion ansible_host=x.x.x.x ansible_user=some_user
[kube_control_plane]
master
# node2
# node3
[etcd]
master
# node2
# node3
[kube_node]
master
# node3
# node4
# node5
# node6
[calico_rr]
[k8s_cluster:children]
kube_control_plane
kube_node
calico_rr
8. ansible 을 이용해 kubernetes 설치
ansible-playbook -i inventory/mycluster/inventory.ini -become --become-user=root cluster.yml --extra-vars "ansible_sudo_pass=1234qwer"
* 에러 발생 시 해볼 것
sudo apt install -y python3-pip sshpass git
9. 설치확인 : node 확인
sudo kubectl get nodes
sudo kubectl get nodes -o wide
Ubuntu SSH 활성화 하기 (0) | 2024.05.29 |
---|---|
kubectl 설치 (0) | 2024.05.29 |
Docker Compose 로 Wordpress 설치하기 (0) | 2024.05.25 |
Docker Compose 설치 및 사용법과 nginx 실행 (0) | 2024.05.25 |
Docker Block I/O 제한하기 (0) | 2024.05.25 |