(二)minikube运行集群实例

  1. 创建一个deployment,运行nginx程序
kubectl run test-nginx --image=nginx:latest
  1. 查看pod
$ kubectl get pods
NAME                          READY     STATUS    RESTARTS   AGE
test-nginx-68d7bfd7bd-x2btj   1/1       Running   0          41s
  1. 创建service expose deployment 端口
kubectl expose  deployment/test-nginx  --type="NodePort" --port=80

查看service

$ kubectl get services
NAME         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP   10.96.0.1              443/TCP        1h
test-nginx   NodePort    10.109.106.7           80:30647/TCP   31m
  1. 访问nginx
$ minikube ip
192.168.99.100
(二)minikube运行集群实例_第1张图片
Screenshot from 2018-04-28 17-43-12.png

你可能感兴趣的:((二)minikube运行集群实例)