Kubernetes minikube,无法在公共IP范围

时间:2017-10-07 09:30:05

标签: kubernetes minikube

所以我一直在玩Minkube。

我设法部署了一个简单的python flask容器:

PS C:\Users\Will> kubectl run test-flask-deploy --image 
192.168.1.201:5000/test_flask:1 
deployment "test-flask-deploy" created

我还设法将部署公开为服务:

PS C:\Users\Will> kubectl expose deployment/test-flask-deploy --
type="NodePort" --port 8080
service "test-flask-deploy" exposed

在仪表板中,我可以看到该服务具有群集IP: 10.0.0.132。

我访问192.168.xxx.xxx地址的仪表板,所以我希望我可以在该外部IP上公开该服务。

知道我怎么回事吗?

一个单独且稍微不那么重要的问题:我已经让minikube与我的网络上的docker注册表进行了对话。如果我部署了一个映像(尚未将其局部拉到minikube上),则部署失败,但是当我在本地minikube上运行docker pull命令时,部署会成功。因此minikube能够提取docker镜像,但是当我部署可通过注册表访问但尚未在本地拉出的图像时,它会失败。有什么想法吗?

编辑:回复评论的更多细节:

PS C:\Users\Will> kubectl describe pod test-flask-deploy
Name:           test-flask-deploy-1049547027-rgf7d
Namespace:      default
Node:           minikube/192.168.99.100
Start Time:     Sat, 07 Oct 2017 10:19:58 +0100
Labels:         pod-template-hash=1049547027
                run=test-flask-deploy
Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"test-flask-deploy-1049547027","uid":"b06a14b8-ab40-11e7-9714-080...
Status:         Running
IP:             172.17.0.4
Created By:     ReplicaSet/test-flask-deploy-1049547027
Controlled By:  ReplicaSet/test-flask-deploy-1049547027
Containers:
  test-flask-deploy:
    Container ID:       docker://577e339ce680bc5dd9388293f1f1ea62be59a6acc25be22889310761222c760f
    Image:              192.168.1.201:5000/test_flask:1
    Image ID:           docker-pullable://192.168.1.201:5000/test_flask@sha256:d303ed635888394f69223cc0a66c5778444fd3636dfcde42295fd512be948898
    Port:               <none>
    State:              Running
      Started:          Sat, 07 Oct 2017 10:19:59 +0100
    Ready:              True
    Restart Count:      0
    Environment:        <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-5rrpm (ro)
Conditions:
  Type          Status
  Initialized   True
  Ready         True
  PodScheduled  True
Volumes:
  default-token-5rrpm:
    Type:       Secret (a volume populated by a Secret)
    SecretName: default-token-5rrpm
    Optional:   false
QoS Class:      BestEffort
Node-Selectors: <none>
Tolerations:    <none>
Events:         <none>

1 个答案:

答案 0 :(得分:0)

首先,检查分配给您的服务的节点端口:

setonItemclick

现在,您应该可以在$ kubectl get svc test-flask-deploy NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE test-flask-deploy 10.0.0.76 <nodes> 8080:30341/TCP 4m 192.168.xxxx:30341上访问它。