使用kubeadm安装k8s集群

SELINUX=disabled

安装docker

yum install -y docker
systemctl enable docker && systemctl start docker

/etc/yum.repos.d/kubernetes.repo

[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg

安装工具

yum install -y kubelet kubeadm kubectl
systemctl enable kubelet && systemctl start kubelet

sysctl内核参数

net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1

docker和kubelet使用相同cgroup

docker info | grep -i cgroup
cat /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

初始化安装,并指定cidr

kubeadm init --pod-network-cidr=10.244.0.0/16

注意保留输出:
kubeadm join --token : --discovery-token-ca-cert-hash sha256:

选用flannel网络

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml

status

kubectl get po -n kube-system

你可能感兴趣的:(使用kubeadm安装k8s集群)