【问题标题】:Accessing Kubernetes dashboard on Compute instance in Oracle Cloud访问 Oracle Cloud 中计算实例上的 Kubernetes 仪表板
【发布时间】:2018-08-04 09:02:20
【问题描述】:

我已将 kubernetes 和仪表板部署到 Oracle 云中的计算实例上。

我在我的计算实例上安装了带有 grafana 的仪表板。

NAME                                       READY     STATUS    RESTARTS   AGE
po/etcd-mst-instance1                      1/1       Running   0          1h
po/heapster-7856f6b566-rkfx5               1/1       Running   0          1h
po/kube-apiserver-mst-instance1            1/1       Running   0          1h
po/kube-controller-manager-mst-instance1   1/1       Running   0          1h
po/kube-dns-d879d6bcb-b9zjf                3/3       Running   0          1h
po/kube-flannel-ds-lgklw                   1/1       Running   0          1h
po/kube-proxy-g6vxm                        1/1       Running   0          1h
po/kube-scheduler-mst-instance1            1/1       Running   0          1h
po/kubernetes-dashboard-dd5c889c-6vphq     1/1       Running   0          1h
po/monitoring-grafana-5d4d76cd65-p7n5l     1/1       Running   0          1h
po/monitoring-influxdb-787479f6fd-8qkg2    1/1       Running   0          1h

NAME                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)         AGE
svc/heapster               ClusterIP   10.98.200.184    <none>        80/TCP          1h
svc/kube-dns               ClusterIP   10.96.0.10       <none>        53/UDP,53/TCP   1h
svc/kubernetes-dashboard   ClusterIP   10.107.155.3     <none>        443/TCP         1h
svc/monitoring-grafana     ClusterIP   10.96.130.226    <none>        80/TCP          1h
svc/monitoring-influxdb    ClusterIP   10.105.163.213   <none>        8086/TCP        1h 

我正在尝试通过 SSH 访问仪表板并在我的本地计算机上执行以下操作:

ssh -L localhost:8001:172.31.4.117:6443 opc@xxxxxxxx

但是,它告诉我这个错误:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

我不确定访问仪表板的最佳方式是什么。我是 k8s 的新手,仍处于初学者阶段,所以想咨询一下,因为我也尝试在本地计算机上做 kubectl 代理,但是当我尝试访问 127.0.0.1 时,它给了我这个错误:

I0804 17:01:28.902675   77193 logs.go:41] http: proxy error: dial tcp [::1]:8080: connect: connection refused

非常感谢您的帮助并感谢您

【问题讨论】:

    标签: kubernetes oracle-cloud-infrastructure


    【解决方案1】:

    Kubernetes 包含一个web dashboard,可用于基本管理操作。

    在您的Kubernetes 集群上安装仪表板后,可以通过几种不同的方式访问它。

    我更喜欢在命令行中使用kubectl proxy 来访问 Kubernetes Dashboard。

    Kubectl 为您服务:使用 API 服务器进行身份验证并在两者之间转发流量 您的集群(内部部署了仪表板)和您的网络浏览器。 请注意,kubectl 为本地运行的 Web 浏览器执行此操作,因为它正在运行 一个本地主机。

    从命令行:

    kubectl proxy
    

    接下来,开始浏览这个地址:

    http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
    

    如果Kubernetes API server 暴露且可访问,您可以尝试:

    https://<master-ip>:<apiserver-port>/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
    

    其中 master-ip 是运行 API 的 Kubernetes 主节点的 IP 地址。

    在单节点设置中,另一种方法是使用NodePort 配置访问仪表板。

    我在仪表板 wiki 上找到了它:

    下面是一个配置示例,供您考虑并适应您的需求:

    apiVersion: v1
    ...
      name: kubernetes-dashboard
      namespace: kube-system
      resourceVersion: "343478"
      selfLink: /api/v1/namespaces/kube-system/services/kubernetes-dashboard-head
    spec:
      clusterIP: <your-cluster-ip>
      externalTrafficPolicy: Cluster
      ports:
      - port: 443
        protocol: TCP
        targetPort: 8443
      selector:
        k8s-app: kubernetes-dashboard
      sessionAffinity: None
      type: NodePort
    

    应用配置后,使用以下命令检查 https 的暴露端口:

    kubectl -n kube-system get service kubernetes-dashboard
    

    如果它返回例如 31707,您可以使用以下命令启动浏览器:

    https://<master-ip>:31707
    

    我受到web ui dashboard guideaccessing dashboard wiki 的启发。

    【讨论】:

      猜你喜欢
      • 2020-06-02
      • 2020-06-12
      • 2018-11-14
      • 1970-01-01
      • 2019-04-20
      • 2019-12-22
      • 2016-12-08
      • 1970-01-01
      相关资源
      最近更新 更多