赞
踩
具体安装步骤同《使用kubeadm工具快速部署Kubernetes集群》,不再赘述,这里记录一下填过的坑。
因kubeadm工具安装部署k8s平台,除了kubelet外,kube-apiserver、kube-controller-manager、kube-scheduler、kube-proxy、etcd、cni插件、CoreDNS都是容器部署,所以要求所有的Docker Image必须是arm64 架构的。而大多数的Image都是amd64的。
表现为:频繁create pod,但又失败,查看日志可发现:exec user process caused "exec format error"。
1、如果可以访问k8s.gcr.io,正常部署即可;
2、可以使用Docker Hub上,按照下图所示搜索支持arm64的镜像,例如:kubesphere/kube-apiserver。手动拉取之后修改tag:
docker tag kubesphere/kube-apiserver:v1.19.0 k8s.gcr.io/kube-apiserver: v1.19.0
镜像列表如下:
k8s.gcr.io/coredns:1.7.0
k8s.gcr.io/kube-proxy:v1.19.0
k8s.gcr.io/pause:3.2
k8s.gcr.io/kube-controller-manager:v1.19.0
k8s.gcr.io/kube-apiserver:v1.19.0
k8s.gcr.io/kube-scheduler:v1.19.0
k8s.gcr.io/etcd:3.4.13-0
quay.io/coreos/flannel:v0.13.0
如果要搭建docker私有镜像库,可以使用docker registry安装部署。果断放弃harbor。
安装步骤:
1、安装pip和依赖包
yum -y install python3-pip python3-devel libffi-devel openssl-devel gcc glibc make
2、升级pip
pip3 install --upgrade pip
# pip3 --version
pip 20.2.4 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)3、编译安装docker-compose
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple docker-compose 或 pip3 install docker-compose
安装完之后,会生成二进制可执行程序:/usr/local/bin/docker-compose,执行如下命令进行验证:
# docker-compose --version
docker-compose version 1.27.4, build unknownFAQ:
1、不能安装python-pip,这是python2.7下的,编译安装的docker-compose不可用
2、如安装完成后不可用,可先卸载,然后将之重新编译安装:
pip3 uninstall docker-compose
pip3 install --force-reinstall docker-compose
# cat registry-deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: docker-regisry
spec:
selector:
matchLabels:
app: docker-regisry
replicas: 1
template:
metadata:
labels:
app: docker-regisry
spec:
nodeName: k8s-02
containers:
- name: docker-regisry
image: registry:2.7.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5000
volumeMounts:
- name: reg-data
mountPath: /var/lib/registry
volumes:
- name: reg-data
hostPath:
path: /home/docker/images
# cat registry-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: docker-regisry
labels:
name: docker-regisry
spec:
type: NodePort
ports:
- port: 5000
targetPort: 5000
nodePort: 5000
protocol: TCP
selector:
app: docker-regisry
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。