ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

5 - CentOS system configuration before k8s installation

2021-06-08 20:04:32  阅读:265  来源: 互联网

标签:both configuration installation CentOS kubernetes etc below yum k8s


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:

  1. 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
  2. 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
  3. 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:

  4. 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

  5. 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
  6. 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
  7. Execute below commands on both nodes, refresh yum cache
    yum clean all
    yum -y makecache
  8. 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.

标签:both,configuration,installation,CentOS,kubernetes,etc,below,yum,k8s
来源: https://www.cnblogs.com/waynewei/p/14852976.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有