kubeadm join 192.168.14.35:6443 --token abcdef.0123456789abcdef \
--discovery-token-ca-cert-hash sha256:54ebcb5c7e7f92c0f146e3ba3345fdd1674b0113680d8cf7be6e4d2d53bc4e71
按照官网的说法,将containerd的config.toml的sandbox_image从3.6改成3.2
--------------------------------
##1 get pods 报错:
E0320 08:24:46.710190 4791 memcache.go:265] couldn't get current server API group list: Get "https://192.168.126.35:6443/api?timeout=32s": tls: failed to verify certificate: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes")
rm -rf .kube/
sudo mkdir ~/.kube
sudo cp /etc/kubernetes/admin.conf ~/.kube/
cd ~/.kube
sudo mv admin.conf config
sudo service kubelet restart
systemctl restart kubelet.service
kubeadm init --pod-network-cidr
--------------------------------
##2 添加阿里云源时,必须用ipv4不知道为什么
-------------------------------
##3 kubeadm reset后,要删除$HOME/.kube,否则再使用kubelet时会报错X509
------------------------------
##4 kubectl命令root不能用
-------------------------------
##5 cannot stat ‘/etc/kubernetes/admin.conf’: No such file or directory
从master节点复制到本节点
--------------------------------
##6 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.
这个节点和control-plane相排斥
--------------------------------
启动流程:
关闭防火墙、swap、
sudo swapoff -a
sudo ufw disable
sudo ufw status
root
rm -rf $HOME/.kube
kubeadm init --config=kubeadm.yaml
su me
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f kube-flannel.yml
kubectl get pods -n kube-system -o wide查看pod状态
kubectl get nodes查看节点
kubectl label no <hostname> kubernetes.io/role=<name>更改roles
-----------------------------------
promethus
kubectl create -f node-exporter.yaml
kubectl create -f k8s-prometheus-grafana/prometheus/rbac-setup.yaml
kubectl create -f k8s-prometheus-grafana/prometheus/configmap.yaml
kubectl create -f k8s-prometheus-grafana/prometheus/prometheus.deploy.yml
kubectl create -f k8s-prometheus-grafana/prometheus/prometheus.svc.yml
-----------------------------------
grafana
kubectl create -f k8s-prometheus-grafana/grafana/grafana-deploy.yaml
kubectl create -f k8s-prometheus-grafana/grafana/grafana-svc.yaml
kubectl create -f k8s-prometheus-grafana/grafana/grafana-ing.yaml