๐ก Kubespray High Availability (HA) Kubernetes โ Executive Summary
Technical architectural analysis, practical configuration manifests, and deployment instructions for Kubespray High Availability (HA) Kubernetes.
References and Guidelines (NOTE)
CoreDNS operation when using systemd-resolved on host
HostNode:
systemd-resolvedis fixed as/etc/resolv.conf = 127.0.0.53loopback address.- The actual resolve defined in
/etc/systemd/resolved.confis/var/run/systemd/resolve/resolv.conf.
Kubelet:
- Default mounts
/etc/resolv.confon HostNode. - Kublet cannot access the loopback address
127.0.0.53.
References and Guidelines (NOTE)
Kubernetes:
- Kubelet Configuration (v1beta1)
--resolv-conf=/var/run/systemd/resolve/resolv.conf
k3s:
bash
k3s server --resolv-conf $value
curl -sfL https://get.k3s.io | sh -s - server --resolv-conf $value
Prepare Deploy Server
Install required packages
bash
apt update
apt install python3-pip # python3.8.10
pip install ansible==4.10.0
#ansible==4.10.0 ,ansible-core==2.11.12 ,kubernetes_v1.24.6
#ansible==2.9.7 ,ansible-core==2.9.6 ,kubernetes_v1.23.7
pip install netaddr
apt-get install sshpass
References and Guidelines (NOTE)
When changing the version, it works well even if you overwrite it without uninstalling it
Preparation
bash
# ๊ฐ ๋
ธ๋์ ๋ณด ์ถ๊ฐ
vi /etc/hosts
# ssh-key ์ค์
ssh-keygen -t rsa
# ์ค์นํ ๋
ธ๋ํธ์คํธ์ pubํค ๋ณต์ฌ
ssh-copy-id root@k8s-master1
Exec
Playbook setting
bash
git clone https://Enterprise Cloudlab:[email protected]/Enterprise Cloudlab/cmp-infra.git
cd ~/cmp-infra/kubernetes/ansible/kubernetes_v1.23.7/
# ํธ์คํธ์ ๋ณด ์์
vi inventory/cmp/inventory.ini
# kube version ๋ฐ ๋๋ ํ ๋ฆฌ ๋ฑ ์์
vi inventory/cmp/group_vars/k8s_cluster/k8s-cluster.yml
# offline.yml์ ์ฃผ์์ฒ๋ฆฌ ๋์ด์์. ๊ฐ์ฅ ์ฐ์ ์์
vi inventory/cmp/group_vars/all/offline.yml
Run Playbook
bash
ansible-playbook -i inventory/$env/inventory.ini cluster.yml -vv
#ansible-playbook myplaybook.yaml -i myinventory --env-container=/path/to/offline.yaml
Detail
Addons
โผ Closed network
External Servers
Prepare OS Image
- RHEL:
Prepare Package Repository
- RHEL:
- DEB:
Prepare File Repository
Preparing Docker Repository (Harbor)
Deploy Server
Edit offline.yaml
After Playbook execution
Before: All Nodes: external repository mount, etchost registration
- RHEL: :import
bash
#harbor host ๋ฑ๋ก
vi /etc/hosts
1Cycle After: All Nodes: Harbor access permission settings
bash
#harbor ๊ถํ ์ธ์ฆ
nerdctl login harbor.Enterprise Cloud.cld
2Cycle After: Master Node: Edit CoreDNS ConfigMap
- :coredns, nodelocaldns Not Running




Leave a Reply