1、环境

centos7 \ docker1.8\ k8s版本 v1.15.2

 

2、参考

   https://www.kubernetes.org.cn/5551.html
   https://www.twblogs.net/a/5c9e8406bd9eee73ef4b63fd

   https://blog.csdn.net/tangwei0928/article/details/93377100

 

========k8s初始化=================

0.[https://www.kubernetes.org.cn/5551.html]
sed -i 's/enforcing/disabled/' /etc/selinux/config

[如果多次安装的]

kubeadm reset
ifconfig cni0 down
ip link delete cni0
ifconfig flannel.1 down
ip link delete flannel.1
rm -rf /var/lib/cni/
-----------------------------------------

/etc/sysctl.d/k8s.conf
-----------------------------------------
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
-----------------------------------------
modprobe br_netfilter
sysctl -p /etc/sysctl.d/k8s.conf
-----------------------------------------
1.
kubeadm init  --kubernetes-version=v1.15.2 --pod-network-cidr=10.244.0.0/16  --service-cidr=10.96.0.0/12 --ignore-preflight-errors=all

结果
kubeadm join 10.0.2.16:6443 --token ved5ph.by42vstizqb6xlb3 \
    --discovery-token-ca-cert-hash sha256:6c4e88ebb479ca1ca426787e7a9d20c4c94d0760ff88e1c7199b732db01c67cd 
2.[test002\test003]
已经装过需要清理[kubeadm reset]
mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config


3.虚拟网卡原因,如果没有问题请忽略这一步
 [https://www.linuxea.com/1934.html]

 wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
 
 vi kube-flannel.yml 增加网卡enp0s3
 
 kubectl  apply -f ./kube-flannel.yml 
 
4.增加node

kubeadm join 10.0.2.16:6443 --token ved5ph.by42vstizqb6xlb3 \
    --discovery-token-ca-cert-hash sha256:6c4e88ebb479ca1ca426787e7a9d20c4c94d0760ff88e1c7199b732db01c67cd 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐