cento7.6安装kubernetes1.14.1
admin
2023-04-04 13:03:41
0

1 .准备:两台虚拟机maste.lab.example.com 192.168.125.142 2cpu 2G 60G
node.lab.example.com 192.168.125.141 2cpu 4G 60G

  1. 更新软件包及源
    更新软件包 yum update -y
    新增源 :cd /etc/yum.repos.d
    mv CentOS-Base.repo CentOS-Base.repo.bak
    curl -o CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/CentOS-Base.repo
    curl -o docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    cat < /etc/yum.repos.d/kubernetes.repo
    [kubernetes]
    name=Kubernetes
    baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
    enabled=1
    gpgcheck=0
    repo_gpgcheck=0
    gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
    http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
    EOF
    yum clean all && yum makecache
  2. 系统设置
    关闭selinux和firewalld
    setenforce 0
    sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
    systemctl stop firewalld && systemctl disable firewalld
    修改内核参数
    cat < /etc/sysctl.d/k8s.conf
    net.bridge.bridge-nf-call-ip6tables = 1
    net.bridge.bridge-nf-call-iptables = 1
    EOF

sysctl -p
加载内核模块
modprobe br_netfilter
lsmod | grep br_netfilter
禁用swap
swapoff -a
echo "vm.swappiness = 0">> /etc/sysctl.conf
sysctl -p

  1. 安装docker
    yum install docker-ce
    设置镜像加速器(这里我使用了自己个人的阿里云镜像加速,根据个人实际情况来写)
    mkdir -p /etc/docker
    tee /etc/docker/daemon.json <<-'EOF'
    {
    "registry-mirrors": ["https://o9ofxrn0.mirror.aliyuncs.com"]
    }
    EOF
    systemctl daemon-reload
    systemctl restart docker && systemctl enable docker
    1. 加载镜像
      由于国内网络已被墙,我在这里事先吧1.14.1的镜像提供出来
      链接:https://pan.baidu.com/s/1QkRoRHLFJxrQHAuslpFN4Q
      提取码:ovgt
      复制这段内容后打开百度网盘手机App,操作更方便哦
    2. 安装kubeadm、kubelet和kubectl
      yum install -y kubelet kubeadm kubectl
      注:我这里现在yum源中是1.14.1的版本,之后会有更新的版本,如果是更高或者是其他版本,我这里提供的镜像就不能用了。
      kubeadm init --pod-network-cidr=10.244.0.0/16
      跑完上面的init命令后会看到类似如下的输出:
      Your Kubernetes master has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:
kubeadm join 192.168.125.142:6443 --token 5fasbl.ctmnsuq04udlb8t2 \
--discovery-token-ca-cert-hash sha256:c7fea93fa4ebcc695a48720fb007185102167bbd7f7ff9d2be178efdee20dad0
接下来你懂的,该怎么做!!!

相关内容

热门资讯

特朗普下令不打了,美国的“余粮... 可以说戛然而止,快得让很多人都无法适应。前两周,每一天美国都要打击伊朗一通。就在7月24日白宫会议前...
穆杰塔巴最新表态:支持黎真主党 △伊朗最高领袖穆杰塔巴·哈梅内伊(资料图)当地时间7月26日晚,伊朗最高领袖穆杰塔巴·哈梅内伊对黎巴...
美军瘫痪一艘驶向伊朗的油轮,特... 美国总统特朗普虽下令暂停打击伊朗,但美军仍在执行对霍尔木兹海峡的封锁任务。针对美军瘫痪一艘驶向伊朗油...
“小牌大耍”的底气到底是哪里来... 澎湃首席评论员 李平这两天,“艺人李权哲乘高铁占座事件”在网上引发热议,该艺人参加的活动主办方曾发布...
越南籍船舶南海遇险沉没,中方已... 据凤凰卫视报道,一艘越南船舶7月24日夜间在越南庆和以东220海里附近遇险沉没,船上共62名越南籍人...
李权哲占座、蒙面、装死:娱乐圈... 你买了一张高铁一等座的票,找到自己的位置,18A。有人坐着。你拿出手机看了眼购票记录——没错,18A...
杭州景区咖啡店闯入1条幼蛇,仅... 夏天气温高、湿度大,蛇类活动进入高峰期,千万别被“小蛇无害”的刻板印象骗了!有些幼蛇看着迷你可爱,实...
AI开源公开信签署企业增至50... IT之家 7 月 26 日消息,英伟达、微软、IBM、Meta 等 25 家美国科技企业本周(7 月...
南阳快手短视频代运营企业的服务... 在短视频平台快速发展的背景下,企业通过快手等渠道进行内容运营已成为常见的市场动作。对于希望借助短视频...
普通人该如何跟上科技发展的步伐 这个被称作科技的词汇, 听起来既有宏大之感, 又颇为遥远, 好似仅仅归属于在实验室里专心致志钻研的科...