温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Centos7 一键安装K8s master节点

发布时间:2020-06-18 11:35:13 来源:网络 阅读:594 作者:xinsir999 栏目:系统运维

#!/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

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI