k8s安装

k8s安装

sysctl -w vm.swappiness=0

swapoff -a

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

  1. 下载阿里云的CentOS-Base.repo 到/etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

forwarded_for off

header_access Via deny all

header_access X-Forwarded-For deny all

http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

–showduplicates

cat </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

yum install -y kubelet kubeadm kubectl –disableexcludes=kubernetes

kubeadm init –apiserver-advertise-address=10.3.71.142 –pod-network-cidr=192.168.0.0/16

https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/#pod-network

http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

kubectl -n kube-system get service kubernetes-dashboard

kubectl create secret generic kubernetes-dashboard-certs –from-file=$HOME/certs -n kube-system

kubectl taint nodes –all node-role.kubernetes.io/master-

参考文档: https://blog.csdn.net/xiegh2014/article/details/84830880