前置环境
时间同步
修改内核参数
1 2 3 4
| cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF
|
安装基础组件
https://github.com/containerd/containerd/releases/download/v1.6.6/containerd-1.6.6-linux-arm64.tar.gz
https://github.com/opencontainers/runc/releases/download/v1.1.1/runc.arm64/
https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-arm64-v1.1.1.tgz
https://github.com/containerd/nerdctl/releases/download/v0.22.2/nerdctl-0.22.2-linux-arm64.tar.gz
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| tar xvf nerdctl-0.22.2-linux-arm64.tar cp nerdctl /usr/local/bin/ rm -rf containerd-rootless* nerdctl
cat > /etc/yum.repos.d/kubernetes.repo <<EOF [kubernetes]name=Kubernetesbase url=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-aarch64 enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpgexclude=kube* EOF
yum -y install kubelet-1.24.3 kubeadm-1.24.3 kubectl-1.24.3 --disableexcludes=kubernetes systemctl enable kubelet.service
|
k8s集群初始化
1
| kubeadm init --apiserver-advertise-address=192.168.254.129 --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.24.3 --service-cidr=10.96.0.0/12 --pod-network-cidr=10.244.0.0/16
|
集群状态检测
查看所有nod节点
查看node的信息
1
| kubectl describe nodes node1
|
查看指定空间内所有Pod
1
| kubectl get po -n kube-system
|
查看Pod的信息
1
| kubectl describe po kube-proxy-np9bz -n kube-system
|
删除Pod
1
| kubectl delete po kube-proxy-dmbqw -n kube-system
|
查看容器的日志
1
| kubectl logs kube-proxy-dmbqw -n kube-system
|
查看命令空间
kubernetes在集群启动之后,会默认创建几个namespace
查看service的信息