使用minikube创建一个service

参考minikube的文档:

启动minikube

$ minikube start

创建一个deployment

$ kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port=8080

登录进minikube创建的虚拟机:

$ minikube ssh

查看创建的deployment所生成的pod容器:

$ docker ps | grep hello

启动dashboard

$ minikube dashboard

查看创建的deployment

$ kubectl expose deployment hello-minikube --type=NodePort

此时hello-minikube的service被创建了:

执行minukubeservice命令,将service给expose出来:

$ minikube service hello-minikube

此时在host上就可以访问这个service了:

My Github Page: https://github.com/liweinan

Powered by Jekyll and Theme by solid

If you have any question want to ask or find bugs regarding with my blog posts, please report it here:
https://github.com/liweinan/liweinan.github.io/issues