簡體   English   中英

使用入口在遠程Kubernetes集群中的訪問服務

[英]Access service in remote Kubernetes cluster using ingress

我正在嘗試訪問部署在遠程機器上的現有kubernetes群集中的服務。 我已將群集配置為可從本地mac通過kubectl訪問。

$ kubectl cluster-info
Kubernetes master is running at https://192.168.58.114:6443
KubeDNS is running at https://192.168.58.114:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

我要連接的服務的入口配置為:

kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: gw-ingress
  namespace: vick-system
  selfLink: /apis/extensions/v1beta1/namespaces/vick-system/ingresses/gw-ingress
  uid: 52b62da6-01c1-11e9-9f59-fa163eb296d8
  resourceVersion: '2695'
  generation: 1
  creationTimestamp: '2018-12-17T06:02:23Z'
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: >
      {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"kubernetes.io/ingress.class":"nginx","nginx.ingress.kubernetes.io/affinity":"cookie","nginx.ingress.kubernetes.io/session-cookie-hash":"sha1","nginx.ingress.kubernetes.io/session-cookie-name":"route"},"name":"gw-ingress","namespace":"vick-system"},"spec":{"rules":[{"host":"wso2-apim-gateway","http":{"paths":[{"backend":{"serviceName":"gateway","servicePort":8280},"path":"/"}]}}],"tls":[{"hosts":["wso2-apim-gateway"]}]}}
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/affinity: cookie
    nginx.ingress.kubernetes.io/session-cookie-hash: sha1
    nginx.ingress.kubernetes.io/session-cookie-name: route
spec:
  tls:
    - hosts:
        - wso2-apim-gateway
  rules:
    - host: wso2-apim-gateway
      http:
        paths:
          - path: /
            backend:
              serviceName: gateway
              servicePort: 8280
status:
  loadBalancer:
    ingress:
      - ip: 172.17.17.100

我的服務清單是: 在此處輸入圖片說明

我的/ etc / hosts文件如下所示:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost

172.17.17.100 wso2-apim-gateway wso2-apim wso2sp-dashboard

我應使用什么URL從本地瀏覽器訪問此服務? 我應該做更多的配置嗎?

訪問此端口最簡單的方法是端口轉發,無需修改主機文件。

kubectl -n vick-system port-forward svc/wso2sp-dashboard 9643

這將允許您瀏覽到http://localhost:9643並訪問該服務。

請注意,僅在kubectl >= 1.10支持svc/name語法

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM