在执行脚本k8s-install.sh的时候,dpkg 被中断,您必须手工运行 sudo dpkg --configure -a解决此问题
安装步骤,主要参考地址(1):https://blog.csdn.net/eyexin2018/article/details/124472233
(2)https://blog.csdn.net/kity9420/article/details/123674582
(3)https://www.cnblogs.com/FengZeng666/p/15502138.html
笔记:https://www.kancloud.cn/panxin20/notes/1743159
查看可安装的版本
sudo apt-cache madison kubelet
安装指定版本
apt-get -y install kubelet=<VERSION_STRING> kubeadm=<VERSION_STRING> kubectl=<VERSION_STRING>
安装完成后检验:获得所有命名空间下的pod、查看版本号、查看服务状态
kubectl get pod -A
kubectl get pods --all-namespaces
kubectl version
systemctl status kubelet
#在master节点生成秘钥
kubeadm token create --print-join-command
#在node1节点中执行加入动作
kubeadm join 192.168.100.114:6443 --token k91fh2.w2qhlcvw6tx5lgfp --discovery-token-ca-cert-hash sha256:1331f01076c578f5e8a221c5d7b2a100e168f19f5cadb64b392366a22af6a525
#给node1节点设置角色
设置角色:kubectl label node node1 node-role.kubernetes.io/worker=
https://blog.csdn.net/qq_21127151/article/details/123740345
删除角色:kubectl label node node1 node-role.kubernetes.io/worker-
部署完成以后,记得配置K8S!
Ingress介绍与安装配置
Docker镜像拉取总结
安装nfs共享存储,否则没法创建PVC
【服务器端】【客户端】
mkdir -p /public/nfs
chmod 777 /public/nfs
apt install -y nfs-common
apt install nfs-kernel-server
systemctl enable nfs
echo "/public/nfs *(async,rw,no_root_squash,no_subtree_check)" > /etc/exports
exportfs -r
systemctl start nfs
showmount -e localhost
【重要】1.24.x以后的安装与1.23之前差别很大,参考链接:k8s v1.24.1安装https://blog.csdn.net/ALEX_CYL/article/details/125227396
k8s v1.24以后不支持docker,而是采用containerd 服务(所以要配置好containerd),所以如果按照老版本安装1.24版本,就会报错:k8s初始化 报错Error getting node“ err=“node
kubernets自v1.24.0后,就不再使用docker.shim,替换采用containerd作为容器运行时端点。因此需要安装containerd(在docker的基础下安装)
https://www.pudn.com/news/6288e61116e0ca7141fc0a06.html
手动创建/root/.kube/config 配置文件后,又报如下错误:The connection to the server localhost:8080 was refused - did you specify the right host or port?
https://blog.csdn.net/lovely_nn/article/details/121519075
kubectl config view 命令查看当前kubeconfig的配置内容
查看日志
journalctl -xefu kubelet
systemctl status kubelet
查看主机名
hostnamectl
重置
kubeadm reset -f
初始化(1.23版本以下)
kubeadm init --pod-network-cidr=192.168.0.0/16 --image-repository=registry.aliyuncs.com/google_containers --apiserver-advertise-address=10.191.20.137
初始化(1.24版本以上)
kubeadm init --image-repository registry.aliyuncs.com/google_containers --kubernetes-version=v1.24.3 --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=10.191.20.137
kubeadm 报错 ”unknown service runtime.v1alpha2.RuntimeService”
参考地址:https://blog.csdn.net/lanwilliam/article/details/125600671
Kubernetes(K8S)各种错误及解决方法
https://blog.csdn.net/u010165147/article/details/122133176
https://blog.csdn.net/Mysoftwear/article/details/124878589
The connection to the server localhost:8080 was refused - did you specify the right host or port?解决
kubenetes master ip地址变了 Error getting node“ err=“node \“master\“ not found
https://blog.csdn.net/sinat_40292249/article/details/121588481
rm -fr $HOME/.kube/config
# --apiserver-advertise-address 更改后的地址
kubeadm init \
--apiserver-advertise-address=192.168.92.128 \
--image-repository registry.aliyuncs.com/google_containers \
--kubernetes-version=v1.22.2 \
--pod-network-cidr=10.244.0.0/16 \
--service-cidr=10.96.0.0/12
只有master的时候,需要设置master可以被调用:
kubectl taint nodes --all node-role.kubernetes.io/master-
FailedScheduling 16s (x2 over 5m28s) default-scheduler 0/1 nodes are available: 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }.
解决办法:http://t.zoukankan.com/xlovepython-p-14468772.html
K8S之taint\cordon\uncordon\drain使用案例
https://blog.csdn.net/qq_34777982/article/details/124472768
查看POD是由哪个deployment或者Set控制
查看服务状态
systemctl status kubelet.service
k8s安装calico网络
ubuntu如何关闭selinux
ubuntu如何关闭swapoff
临时关闭
swapoff -a
永久关闭
vim /etc/fstab
注释掉最后一行的swap
Unit nfs.service not found
ubuntu 10.0开启配置nfs 服务service nfs start时出现:
Failed to start nfs.service: Unit nfs.service not found.
原因是ubuntu 10.0以上的版本取消了service nfs start。
改成了sudo service nfs-server start 。这样就完成启动了。
在执行sudo service nfs-server status就可以看到