【发布时间】:2017-06-24 02:02:04
【问题描述】:
这是我的集群信息
kubectl cluster-info
Kubernetes master is running at https://129.146.10.66:6443
Heapster is running at https://129.146.10.66:6443/api/v1/proxy/namespaces/kube-system/services/heapster
KubeDNS is running at https://129.146.10.66:6443/api/v1/proxy/namespaces/kube-system/services/kube-dns
所以,我有一个服务(mysqlbrokerservice)作为 NodePort 运行,配置如下所示
kubectl describe svc mysqlbrokerservice
Name: mysqlbrokerservice
Namespace: mysqlbroker
Labels: <none>
Annotations: <none>
Selector: app=mysqlbroker
Type: NodePort
IP: 10.99.194.191
Port: mysqlbroker 8080/TCP
NodePort: mysqlbroker 30000/TCP
Endpoints: 10.244.1.198:8080
Session Affinity: None
Events: <none>
我可以像这样http://129.146.34.181:30000/v2/catalog这样通过pod所在节点的公网IP访问服务。
那我想看看能不能通过https访问服务。我跟着https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#manually-constructing-apiserver-proxy-urls中的方向走
我按照示例使用 curl 来获取资源。 这是命令。 129.146.10.66:6443 是我的主IP。
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET https://129.146.10.66:6443/api/v1/namespaces/mysqlbroker/services/mysqlbrokerservice:8080/proxy/v2/catalog --header "Authorization: Bearer $TOKEN" --insecure
HTTP/1.0 200 Connection established
curl 只是坐在那里没有任何反应。然后我查看了我的 pod 日志,它没有显示收到任何请求。
有人可以解释我在这里做错了什么吗?如果我希望通过 https 公开服务,理想的解决方案是什么?
【问题讨论】:
-
您找到这个问题的答案了吗?可以分享吗?
标签: kubernetes