标签:top k RKE hash tar systemctl 安装docker port 问题 列表
master内存至少4GiB
sudo swapoff -a
sudo vi /etc/fstab
把/dev/mapper/centos-swap swap这行注释掉
cat > /etc/sysctl.d/k8s.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
vm.swappiness=0
EOF
sysctl --system
参见网络其他文章
hostnamectl set-hostname xx
cat >> /etc/hosts <<EOF
172.16.225.129 k8s-02
172.16.225.130 k8s-03
172.16.225.200 k8s-01
EOF
# k8s yum源
cat > /etc/yum.repos.d/kubernetes.repo <<EOF
[kubernetes]
name=kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
gpgcheck=0
enable=1
EOF
>>
cd /etc/yum.repos.d
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum clean all
yum repolist
yum install -y docker-ce kubeadm kubelet kubectl
systemctl enable --now docker && systemctl enable --now kubelet
systemctl status kubelet
journalctl -xeu kubelet
安装master,法一:
查询列表
kubeadm config images list
kubeadm config print init-defaults > kubeadm.yaml
cat <<EOF > kubeadm.yaml
apiVersion: kubeadm.k8s.io/v1beta2
kind: InitConfiguration
nodeRegistration: # 去掉master污点
taints:
- effect: PreferNoSchedule
key: node-role.kubernetes.io/master
---
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
imageRepository: registry.aliyuncs.com/google_containers # images地址
kubernetesVersion: v1.17.0 # version
EOF
kubeadm token create --print-join-command
return a token
kubeadm join 172.17.55.202:6443 --token 4xv6eq.5kygve4g6uy1smat \ --discovery-token-ca-cert-hash sha256:3ab287132d40f511925d0e416a6a0bd1fba47697c447b6c05f421b12029b8766
To start using your cluster, you need to run the following as a regular user:
kubeadm reset
iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X
rm -rf $HOME/.kube/config
systemctl stop docker
systemctl stop kubelet
yum remove kubelet
iptables -tnat --flush # iptables 一定要刷新
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
系统设置
配置k8s,docker yum源
下载docker kubelet kubeadm
通过tocken加入集群。 注意tocken的有效期为24小时
修改nodePort
kubectl patch svc -n kube-system kubernetes-dashboard -p ‘{"spec":{"type":"NodePort"}}‘
kubectl create serviceaccount dashboard-admin -n kube-system
kubectl create clusterrolebinding dashboard-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
kubectl describe secret -n kube-system dashboard-admin
查看安装
kubectl get pods -n rook-ceph-system
kubectl get pods -n rook-ceph
# coredns readiness 一直unhealthy
coredns dial tcp 10.96.0.1:443: connect: no route to host
# 问题
iptables混乱导致
# 解决办法
systemctl stop kubelet
systemctl stop docker
iptables --flush
iptables -tnat --flush
systemctl start kubelet
systemctl start docker
kubectl delete pod weave -n kube-system
标签:top k RKE hash tar systemctl 安装docker port 问题 列表
原文地址:https://www.cnblogs.com/showmycode/p/12290035.html