5 - CentOS system configuration before k8s installation
2021/6/9 7:23:12
本文主要是介绍5 - CentOS system configuration before k8s installation,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Prerequisites:
Node | OS | IP |
k8s-master | CentOS7 | 192.168.137.161 |
k8s-node1 | CentOS7 | 192.168.137.162 |
Now we have 2 working CentOS virtual machine, which can connect to each other, also able access to Internet. Let's do some configuration before we provision kubernetes cluster on them.
Install kubernetes:
- Disable firewall for both master and node by running below command
firewall-cmd --state # check firewall state systemctl stop firewalld.service # stop firewall systemctl disable firewalld.service # disable firewall to auto launch
- Disable SELinux module for both master and node by running below command
getenforce # check SELinux status setenforce 0 # stop SELinux sed -i "s/SELINUX\=.*/SELINUX=disable/g" /etc/selinux/config # disable SELinux module shutdown -r now # Reboot system is required
- Update host name
Execute below command for master node:
more /etc/hostname # check current hostname hostnamectl set-hostname master01 # update hostname to master01
Perform the same command to update hostname of k8s-node1:
- Modify hosts file /etc/hosts on both node k8s-master and k8s-node1
Execute below command to append host details to the end of file /etc/hosts:
cat >> /etc/hosts << EOF 192.168.137.161 master01 192.168.137.162 node01
NOTE: Perform the same update for k8s-node1
- Disable swap
Run below commands swapoff -a on both k8s-master and k8s-node1:
swapoff -a # switch of swap temporary free -m # check if swap turned off successful, the line swap should be showing 0
- Setting up yum resource for both nodes
Since some of external site been blocked, so we need to repoint yum source to domestic agent resource, running below command to setup:
cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg EOF
- Execute below commands on both nodes, refresh yum cache
yum clean all yum -y makecache
- All set for system configuration now. We are ready to provision container and Kubernetes !
Next let's get Docker installed from both master01 and node1.
这篇关于5 - CentOS system configuration before k8s installation的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-15在Kubernetes (k8s) 中搭建三台 Nginx 服务器怎么实现?-icode9专业技术文章分享
- 2024-11-05基于Kubernetes的自定义AWS云平台搭建指南
- 2024-11-05基于Kubernetes Gateway API的现代流量管理方案
- 2024-11-05在Kubernetes上部署你的第一个应用:Nginx服务器
- 2024-11-05利用拓扑感知路由控制Kubernetes中的流量
- 2024-11-05Kubernetes中的层次命名空间:更灵活的资源管理方案
- 2024-11-055分钟上手 Kubernetes:精简实用的 Kubectl 命令速查宝典!
- 2024-10-30K8s 容器的定向调度与亲和性
- 2024-10-28云原生周刊:K8s未来三大发展方向 丨2024.10.28
- 2024-10-25亚马逊弹性Kubernetes服务(EKS)实战:轻松搭建Kubernetes平台