Centos7.6上yum安装kubernetes报错:
Error: docker-ce-cli conflicts with 2:docker-1.13.1-91.git07f3374.el7.centos.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
原因:yum安装kubernetes之前已经安装过docker,导致出现上面报错;
按照提供执行 rpm -Va --nofiles --nodigest 命令并没有作用,还是避免不了冲突;
解决方法:
卸载
1、查询安装过的包
yum list installed | grep docker
containerd.io.x86_64 1.2.4-3.1.el7 @docker-ce-edge
docker-ce-cli.x86_64 1:18.09.3-3.el7 @docker-ce-edge
2、删除安装的软件包
yum -y remove docker-ce-cli.x86_64
yum -y remove containerd.io.x86_64
3、删除镜像/容器等
rm -rf /var/lib/docker
rm -rf /var/run/docker
安装
yum install -y etcd kubernetes
完美解决问题!
第二步 测试安装情况
vim mysql-rc.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: mysql
spec:
replicas: 1
selector:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql
ports:
- containerPort: 3306
env:
- name: MYSQL_ROOT_PASSWORD
value: "123456"
kubectl create -f mysql-rc.yaml
kubectl get rc
NAME DESIRED CURRENT READY AGE
mysql 1 1 0 12m
vim Mysql-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: mysql1
spec:
type: NodePort
ports:
- port: 3307
nodePort: 32307
targetPort: 3306
selector:
app: mysql
kubectl create -f mysql-svc.yaml
kubectl get pods
NAME READY STATUS RESTARTS AGE
mysql-zqgck 0/1 ContainerCreating 0 13m
kubectl describe pod mysql
第二步遇到的问题
open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory
vi /etc/kubernetes/kubelet
修改 KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=10.30.30.126:5000/pod-infrastructure:latest"
docker search pod-infrastructure