您好,登錄后才能下訂單哦!
#!/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驅動
#echo "docker 驅動為:"
#docker info |grep Cgroup
#sleep 5
#修改kubctl驅動 由 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 "請輸入本機ip地址:" IP
#啟動k8s
kubeadm init --kubernetes-version=v1.10.0 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=$IP
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。