Minikube 基础插件 addons
标签:
Kubernetes
minikube 通过插件的方式提供了 k8s 集群的基本服务。
Minikube 插件
查看所有插件
minikube addons list
输入如下:
- addon-manager: enabled - coredns: disabled - dashboard: enabled - default-storageclass: enabled - efk: disabled - freshpod: disabled - heapster: disabled - ingress: disabled - kube-dns: enabled - metrics-server: disabled - registry: disabled - registry-creds: disabled - storage-provisioner: enabled
默认启用的:
【插件管理】addon-manager
【可视化管理面板】dashboard
【存储类】default-storageclass
【DNS服务】kube-dns
【存储提供者】storage-provisioner
可以看到 minikube 默认为我们启动了一些插件,插件启动的服务的 namespace 一般为 kube-system ,查看该 namespace 下的 pods 和 services:
kubectl get pods,services -n kube-system
输入如下:
NAME READY STATUS RESTARTS AGE pod/kube-addon-manager-minikube 0/1 ContainerCreating 0 5h
从状态可以看到,服务没有启动成功,查看原因:
kubectl get events -n kube-system
输出如下:
LAST SEEN FIRST SEEN COUNT NAME KIND SUBOBJECT TYPE REASON SOURCE MESSAGE18m 6h 658 kube-addon-manager-minikube.152cd7f6ac31a536 Pod Warning FailedCreatePodSandBox kubelet, minikube Failed create pod sandbox: rpc error: code = Unknown desc = failed pulling image "k8s.gcr.io/pause-amd64:3.1": Error response from daemon: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
很明显,无法获取到镜像 k8s.gcr.io/pause-amd64:3.1,因为墙的原因,虽然 Minikube 启动成功了,但是相关的基础服务都无法正常启动。如何解决呢?只需在 Minikube 创建的 VM 中拉取相应镜像即可。
解决基础服务的启动问题
进入 minikube VM
minikube ssh
获取所有相关镜像
export image=pause-amd64:3.1 docker pull registry.cn-hangzhou.aliyuncs.com/anoy/${image}docker tag registry.cn-hangzhou.aliyuncs.com/anoy/${image} k8s.gcr.io/${image}docker rmi registry.cn-hangzhou.aliyuncs.com/anoy/${image}export image=kube-addon-manager:v8.6 docker pull registry.cn-hangzhou.aliyuncs.com/anoy/${image}docker tag registry.cn-hangzhou.aliyuncs.com/anoy/${image} k8s.gcr.io/${image}docker rmi registry.cn-hangzhou.aliyuncs.com/anoy/${image}export image=kubernetes-dashboard-amd64:v1.8.1 docker pull registry.cn-hangzhou.aliyuncs.com/anoy/${image}docker tag registry.cn-hangzhou.aliyuncs.com/anoy/${image} k8s.gcr.io/${image}docker rmi registry.cn-hangzhou.aliyuncs.com/anoy/${image}export image=storage-provisioner:v1.8.1 docker pull registry.cn-hangzhou.aliyuncs.com/anoy/${image}docker tag registry.cn-hangzhou.aliyuncs.com/anoy/${image} gcr.io/k8s-minikube/${image}docker rmi registry.cn-hangzhou.aliyuncs.com/anoy/${image}export image=k8s-dns-sidecar-amd64:1.14.5 docker pull registry.cn-hangzhou.aliyuncs.com/anoy/${image}docker tag registry.cn-hangzhou.aliyuncs.com/anoy/${image} k8s.gcr.io/${image}docker rmi registry.cn-hangzhou.aliyuncs.com/anoy/${image}export image=k8s-dns-kube-dns-amd64:1.14.5 docker pull registry.cn-hangzhou.aliyuncs.com/anoy/${image}docker tag registry.cn-hangzhou.aliyuncs.com/anoy/${image} k8s.gcr.io/${image}docker rmi registry.cn-hangzhou.aliyuncs.com/anoy/${image}export image=k8s-dns-dnsmasq-nanny-amd64:1.14.5 docker pull registry.cn-hangzhou.aliyuncs.com/anoy/${image}docker tag registry.cn-hangzhou.aliyuncs.com/anoy/${image} k8s.gcr.io/${image}docker rmi registry.cn-hangzhou.aliyuncs.com/anoy/${image}
技巧:在 dockerHub 或 阿里云镜像仓库中找到相应版本的镜像,并重新 tag 就能让服务正常运行
等待 1 分钟左右后,再次查看 pods 和 services
kubectl get pods,services -n kube-system
输出如下
NAME READY STATUS RESTARTS AGE pod/kube-addon-manager-minikube 1/1 Running 0 6h pod/kube-dns-6dcb57bcc8-qn5ml 3/3 Running 0 22m pod/kubernetes-dashboard-5498ccf677-ptnn9 1/1 Running 0 22m pod/storage-provisioner 1/1 Running 0 22m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP 22m service/kubernetes-dashboard NodePort 10.96.249.239 <none> 80:30000/TCP 22m
至此,本机搭建的 k8s 集群就能正常工作了。
插件管理
未完待续。。。。
作者:Anoyi
链接:https://www.jianshu.com/p/73a92cddadd5
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦