> /etc/hosts#echo 192.168.5.131 k8s1 >> /etc/hosts#echo 192.168.5.132 k8s2 >> /..."/>
溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Centos7 一鍵安裝K8s master節(jié)點(diǎn)

發(fā)布時(shí)間:2020-06-18 11:35:13 來源:網(wǎng)絡(luò) 閱讀:593 作者:xinsir999 欄目:系統(tǒng)運(yùn)維

#!/bin/bash
#hostnamectl set-hostname k8s
#echo "192.168.5.130 k8s" >> /etc/hosts
#echo "192.168.5.131 k8s1" >> /etc/hosts
#echo "192.168.5.132 k8s2" >> /etc/hosts
#systemctl stop firewalld && systemctl disable firewalld
#sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/sysconfig/selinux
#swapoff -a
#SwapLineNumber=sed -n '/swap/=' /etc/fstab
#sed -i $SwapLineNumber's/^/#&/' /etc/fstab
#echo net.bridge.bridge-nf-call-ip6tables = 1 >> /etc/sysctl.d/k8s.conf
#echo net.bridge.bridge-nf-call-iptables = 1 >> /etc/sysctl.d/k8s.conf
#echo net.ipv4.ip_forward = 1 >> /etc/sysctl.d/k8s.conf
#modprobe br_netfilter
#sysctl -p /etc/sysctl.d/k8s.conf
#下載鏡像
#docker pull cnych/kube-apiserver-amd64:v1.10.0
#docker pull cnych/kube-scheduler-amd64:v1.10.0
#docker pull cnych/kube-controller-manager-amd64:v1.10.0
#docker pull cnych/kube-proxy-amd64:v1.10.0
#docker pull cnych/k8s-dns-kube-dns-amd64:1.14.8
#docker pull cnych/k8s-dns-dnsmasq-nanny-amd64:1.14.8
#docker pull cnych/k8s-dns-sidecar-amd64:1.14.8
#docker pull cnych/etcd-amd64:3.1.12
#docker pull cnych/flannel:v0.10.0-amd64
#docker pull cnych/pause-amd64:3.1

#docker tag cnych/kube-apiserver-amd64:v1.10.0 k8s.gcr.io/kube-apiserver-amd64:v1.10.0
#docker tag cnych/kube-scheduler-amd64:v1.10.0 k8s.gcr.io/kube-scheduler-amd64:v1.10.0
#docker tag cnych/kube-controller-manager-amd64:v1.10.0 k8s.gcr.io/kube-controller-manager-amd64:v1.10.0
#docker tag cnych/kube-proxy-amd64:v1.10.0 k8s.gcr.io/kube-proxy-amd64:v1.10.0
#docker tag cnych/k8s-dns-kube-dns-amd64:1.14.8 k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.8
#docker tag cnych/k8s-dns-dnsmasq-nanny-amd64:1.14.8 k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.8
#docker tag cnych/k8s-dns-sidecar-amd64:1.14.8 k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.8
#docker tag cnych/etcd-amd64:3.1.12 k8s.gcr.io/etcd-amd64:3.1.12
#docker tag cnych/flannel:v0.10.0-amd64 quay.io/coreos/flannel:v0.10.0-amd64
#docker tag cnych/pause-amd64:3.1 k8s.gcr.io/pause-amd64:3.1

#docker rmi cnych/kube-apiserver-amd64:v1.10.0
#docker rmi cnych/kube-scheduler-amd64:v1.10.0
#docker rmi cnych/kube-controller-manager-amd64:v1.10.0
#docker rmi cnych/kube-proxy-amd64:v1.10.0
#docker rmi cnych/k8s-dns-kube-dns-amd64:1.14.8
#docker rmi cnych/k8s-dns-dnsmasq-nanny-amd64:1.14.8
#docker rmi cnych/k8s-dns-sidecar-amd64:1.14.8
#docker rmi cnych/etcd-amd64:3.1.12
#docker rmi cnych/flannel:v0.10.0-amd64
#docker rmi cnych/pause-amd64:3.1

#添加yum源
#cat <<EOF > /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
#安裝kubctl
#yum makecache fast && yum install -y kubelet-1.10.0-0
#yum install -y kubeadm-1.10.0-0 kubectl-1.10.0-0 kubernetes-cni-0.6.0-0.x86_64.rpm
#查看docker驅(qū)動(dòng)
#echo "docker 驅(qū)動(dòng)為:"
#docker info |grep Cgroup
#sleep 5
#修改kubctl驅(qū)動(dòng) 由 systemed--->cgroupfs
#cgroupdriverlineNumber=sed -n '/systemd/=' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
#sed -i "s/systemd/cgroupfs/g" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
#重新加載kubectl daemon
#systemctl daemon-reload

read -p "請(qǐng)輸入本機(jī)ip地址:" IP
#啟動(dòng)k8s
kubeadm init --kubernetes-version=v1.10.0 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=$IP

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI