kubernet

2021-01-20 12:15

阅读:481

标签:安装   run   dep   yaml   The   device   fst   cluster   with   

kubernet

1、关闭swap
swapoff -a
/etc/fstab 注释swap分区

2、将桥接的IPv4流量传递到iptables的链
cat > /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system

3、安装docker-ce
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce

 

4、修改docker配置文件
/etc/docker/docker.jason
{
"registry-mirrors": ["https://registry.docker-cn.com"],
"exec-opts":["native.cgroupdriver=systemd"]
}


4、增加kubernet源

cat /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

5、安装kubectl kubelet kubeadm
dnf install kubectl kubelet kubeadm

6、初始化kubernet
kubeadm init --kubernetes-version=1.18.0 \
--apiserver-advertise-address=10.21.101.39 \
--image-repository registry.aliyuncs.com/google_containers \
--service-cidr=10.10.0.0/16 --pod-network-cidr=10.20.0.0/16


Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following 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

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 10.21.101.39:6443 --token hd4gc7.d5sa6bmz16ezlfib \
--discovery-token-ca-cert-hash sha256:a19b147eadb269f5b7aa5b9a4f1926f523609745530e38e0f06d4537e24eae4c

7、配置kubernet
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

source

8、安装dashboard

kubectl apply -f recommended.yaml
kubectl replace --force -f recommended.yaml


kubectl create serviceaccount dashboard-admin -n kube-system
kubectl create clusterrolebinding dashboard-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
kubectl describe -n=kube-system secret dashboard-admin-token-fq982

kubernet

标签:安装   run   dep   yaml   The   device   fst   cluster   with   

原文地址:https://www.cnblogs.com/timlong/p/13307422.html


评论


亲,登录后才可以留言!