岁月绵长,人间静好

Hey guys, Here is GouGui's Blog !

CentOS7安装minikube搭建kubernetes学习环境

一、先要安装docker,官网(https://docs.docker.com/engine/install/)有教程,一步步操作即可,或者直接用以下命令直接自动安装

二、按照minikube官网(https://minikube.sigs.k8s.io/docs/start/#install-a-hypervisor)的教程安装minikube

完成后执行启动命令
minikube start
后续操作见官网教程,这里不再赘述
三、常见报错
1、Exiting due to RSRC_INSUFFICIENT_CORES: Requested cpu count 2 is greater than the available cpus of 1
服务器最低要求:2 CPUs or more,2GB of free memory
2、安装完docker, 安装完minikube, 依然不能启动
报错内容为
Exiting due to DRV_AS_ROOT: The “docker” driver should not be used with root privileges
所以要创建新的非 root 用户

在 allow root 那一栏添加 username ALL=(ALL) ALL
从 root 切换普通用户为 su – g 启动docker
3、报错unable to do port forwarding: socat not found

4、如果查看Pod的状态,发现状态为 ErrImagePull 或者 ImagePullBackOff:

NAME READY STATUS RESTARTS AGE
fail-1034443984-jerry 0/1 ImagePullBackOff 0 2m
可以使用describe命令查看这个失败的Pod的明细:

我这里是发现虚拟机无法连接k8s.gcr.io/echoserver:1.4相应的网址,应该是国内安全上网原因,换成国外云机就可以了,或者自行修改对应的国内源
5、Minikube启动Dashboard后默认只能localhost访问,如果需要开放外部访问需要添加一层代理
启动Dashbord

使用proxy代理到虚拟机的指定端口

启动后外部访问链接:

点赞

发表评论

邮箱地址不会被公开。 必填项已用*标注