CentOS7使用kubeadm安装 kubernete v1.8
准备三台机器(虚拟机)192.168.1.40 k8s-master192.168.1.41 k8s-node1192.168.1.42 k8s-node2关闭防火墙systemctl stop firewalldsystemctl disable firewalld创建/etc/sysctl.d/k8s.conf文件,添加如下内容:net.brid
·
准备三台机器(虚拟机)
192.168.1.40 k8s-master
192.168.1.41 k8s-node1
192.168.1.42 k8s-node2
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
创建/etc/sysctl.d/k8s.conf文件,添加如下内容:
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
vm.swappiness=0
执行sysctl -p /etc/sysctl.d/k8s.conf使修改生效
删除swap
swapoff -a
vi /etc/fstab
注释掉如下行
/home/swap swap swap default 0 0
删除 rm /home/swap
禁用SELINUX:
setenforce 0
vi /etc/selinux/configSELINUX=disabled
安装Docker(使用阿里云镜像)
# step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新并安装 Docker-CE
sudo yum makecache fast
yum install -y --setopt=obsoletes=0 \
docker-ce-17.03.2.ce-1.el7.centos \
docker-ce-selinux-17.03.2.ce-1.el7.centos
systemctl start docker
systemctl enable docker
安装rpm
yum install
-y socat
rpm -iv kubeadm-1.8.0-1.x86_64.rpm kubectl-1.8.0-1.x86_64.rpm kubelet-1.8.0-1.x86_64.rpm kubernetes-cni-0.5.1-1.x86_64.rpm
Master初始化
kubeadm init \
--kubernetes-version=v1.8.1 \
--pod-network-cidr=10.244.0.0/16
To start using your cluster, you need to run (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
node节点加入集群
kubeadm join --token 06c7f3.b3fcabe04b38dc00 192.168.1.40:6443 --discovery-token-ca-cert-hash sha256:2163f86ffd232335afd3d7b6899753953ab4c348428667ffe7959bbf0082af52
更多推荐
已为社区贡献1条内容
所有评论(0)