kubernetes 安装手册
本文介绍在龙芯架构上,以 loongnix-server 系统为基础,利用 kubeadm 快速部署 kubernetes 1.20.0 的操作步骤。
1. 环境准备
- loongnix-server 操作系统
- docker
2. 部署步骤
2.1. 安装kubernetes 相关的 rpm 软件包
yum install loongnix-release-kubernetes -y
yum makecache
yum install cri-tools kubectl kubelet kubernetes-cni kubeadm docker-ce -y
2.2. 配置 docker
修改 docker 默认仓库,指向龙芯容器镜像仓库https://cr.loongnix.cn
,可参考龙芯容器镜像仓库使用手册。
2.3. 清理操作系统环境
swapoff -a
systemctl restart docker
iptables -F
iptables -X
iptables -Z
iptables -t nat -F
iptables -t nat -X
iptables -t nat -Z
2.4. 一行命令部署 kubernetes
kubeadm init --image-repository cr.loongnix.cn/kubernetes --kubernetes-version 1.20.0 -v=5
2.5. 查看部署状态
[root@k8s-master1 ~]# kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-7cb7cc6b47-fz245 0/1 ContainerCreating 0 12m
kube-system coredns-7cb7cc6b47-xgzhj 0/1 ContainerCreating 0 12m
kube-system etcd-k8s-master1 1/1 Running 0 12m
kube-system kube-apiserver-k8s-master1 1/1 Running 0 12m
kube-system kube-controller-manager-k8s-master1 1/1 Running 0 12m
kube-system kube-proxy-pmg9d 1/1 Running 0 12m
kube-system kube-scheduler-k8s-master1 1/1 Running 0 12m
[root@k8s-master1 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master1 Ready control-plane,master 12m v1.20.0