常见错误

The connection to the server localhost:8080 was refused - did you specify the right host or port?

https://github.com/kubernetes/minikube/issues/855

unset KUBECONFIG
minikube start

一,安装docker

#docker-ce安装
sudo yum install

#启动docker服务
sudo systemctl start docker

设置开机自启动
#systemctl start docker

二,安装kubectl

#下载最新版本
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl

#下载指定版本
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.7.0/bin/linux/amd64/kubectl

#增加执行权限
chmod +x ./kubectl

#将二进制文件移动到PATH中
sudo mv ./kubectl /usr/local/bin/kubectl

三,下载minikube

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

四,创建用户

useradd minikube

passwd minikube

sudo usermod -aG docker minikube && newgrp docker

su minikube

4,启动

#配置使用阿里云的镜像源进行下载
minikube start --image-mirror-country cn --iso-url=https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/iso/minikube-v1.5.0.iso --registry-mirror=https://d7lvdc1m.mirror.aliyuncs.com

#minikube有两种运行方式
#1:运行在虚拟机,这要求当前电脑上要先安装VirtualBox或者KVM;
#2:运行在宿主机,这种方式不需要在当前电脑安装ViirtualBox或者KVM
#--vm-driver=none表示运行在宿主机

minikube start --vm-driver=none

启动报错:

stderr:
        [WARNING FileContent--proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables does not exist
        [WARNING SystemVerification]: failed to parse kernel config: unable to load kernel module: "configs", output: "modprobe: FATAL: Module configs not found in directory /lib/modules/3.10.0-1062.9.1.el7.x86_64\n", err: exit status 1
        [WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR ImagePull]: failed to pull image registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:v1.8.6: output: Error response from daemon: Get "https://registry.cn-hangzhou.aliyuncs.com/v2/": net/http: TLS handshake timeout
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher

有一个镜像拉取失败

docker pull coredns/coredns

docker tag coredns/coredns:latest registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:v1.8.6

docker rmi coredns/coredns:latest

minikube image load registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:v1.8.6
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐