Article Directory
1. Prerequisites
- Single Master, multi-Node deployment architecture
- Requires host network communication, no network restrictions
- Requires root user privileges to deploy
2. Use Ansible to deploy K8S cluster steps
Step 1: Obtain the offline installation package
from Baidu Netdisk
Step 2: Install the ansible command
tar zxf k8s1.27.tar.gz && cd k8s1.27/Packages
tar zxf ansible.tar.gz && cd ansible
yum localinstall *
Step 3: Configure the installation host information (required)
vim k8s1.27/hosts
Parameter explanation:
- ansible_ssh_user: execution user
- ansible_ssh_pass: execute user password
- ansible_sudo_pass: execute user password (sudo permission)
- ansible_ssh_port: connect SSH port
Step 4: Specify the location of the Packages directory (required)
vim k8s1.27/config.yml
Step 5: Execute the script and wait patiently for the process. Offline deployment does not involve the network, which is relatively fast, about (10 minutes)
cd k8s1.27
ansible-playbook -i hosts k8sv1.27_kubeadm_install.yml
After the deployment is completed, the following figure is displayed:
Step 6: Verify the cluster, the status is to Ready
indicate completion, if it is, NotReady
please wait patiently.
kubectl get nodes
3. Expand content
1. Add multiple Node nodes
Step 1: k8s1.27/hosts
Add new node information
vim k8s1.27/hosts
Step 2: k8s1.27/roles/k8s-envInit/templates/hosts.j2
Add new index location
vim k8s1.27/roles/k8s-envInit/templates/hosts.j2