什么是Kibana UI的URL

时间:2018-05-08 13:42:49

标签: kubernetes kibana efk

http://grs-preprodkubemaster01:5601/kibana

我已经关注了文档并安装了Kibana,当我使用该服务作为类型:LoadBalancer时,服务不是 即将到来,所以我删除了类型:LoadBalancer并让它默认为ClusterIP,它很好。 (注意我没有AWS) 但是,我不知道如何访问用户界面,我尝试了这个网址,但它不起作用。 http://my-preprodkubemaster01/api/v1/proxy/namespaces/kube-system/services/elasticsearch-logging/app/kibana 任何想法如何访问Kibana UI。我检查了服务,部署,一切都是绿色检查。

我尝试的另一件事是这个带有此URL的URL,我从命令kubectl cluster-info获得 https://10.123.24.107:6443/api/v1/namespaces/kube-system/services/kibana-logging/proxy 但是,这显示了我的错误

{
kind: "Status",
apiVersion: "v1",
metadata: { },
status: "Failure",
message: "services "kibana-logging" is forbidden: User "system:anonymous" cannot get services/proxy in the namespace "kube-system"",
reason: "Forbidden",
details: {
name: "kibana-logging",
kind: "services"
},
code: 403
}

所以,作为另一次尝试,我使用Kibana服务作为NodePort,但这也不起作用。

apiVersion: v1
kind: Service
metadata:
  name: kibana-logging
  namespace: kube-system
  labels:
    k8s-app: kibana-logging
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
    kubernetes.io/name: "Kibana"
spec:
  selector:
    k8s-app: kibana-logging
  type: NodePort
  ports:
  - port: 5601
    protocol: TCP
    targetPort: ui
    nodePort: 30887

$  kubectl -n kube-system get rc,svc,cm,po
NAME                        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
svc/elasticsearch-logging   ClusterIP   10.98.10.182     <none>        9200/TCP         12m
svc/heapster                ClusterIP   10.107.184.85    <none>        80/TCP           3d
svc/kibana-logging          NodePort    10.102.254.129   <none>        5601:30887/TCP   12m
svc/kube-dns                ClusterIP   10.96.0.10       <none>        53/UDP,53/TCP    3d
svc/kubernetes-dashboard    ClusterIP   10.105.30.246    <none>        80/TCP           3d
svc/monitoring-influxdb     ClusterIP   10.109.144.39    <none>        8086/TCP         3d

我想知道我应该使用什么URL来访问Kibana UI。请注意,我有npot试图做kubectl代理,我想让它没有它

3 个答案:

答案 0 :(得分:1)

使用您在服务中定义的NodePort:

https://10.123.24.107:30887

答案 1 :(得分:1)

在群集外部公开内部服务器的最常用方法是Ingress

首先,您需要在Kubernetes集群中运行Ingress控制器 有两种类型的维护Ingress控制器 - GCEnginx

然后,您需要创建一个yaml文件,如下所示,并根据您的需要进行更改:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
spec:
  backend:
    serviceName: testsvc
    servicePort: 80

使用kubectl create -f创建时,您会看到以下内容:

$ kubectl get ingress
NAME                RULE          BACKEND        ADDRESS
test-ingress        -             testsvc:80     1.2.3.4

在此示例中,1.2.3.4是Ingress控制器分配的IP。

当您拥有所有内容后,您将能够通过IP 1.2.3.4

访问您的应用程序(Kibana)

请在Ingress documentation

中找到更多示例和用例

您也可以在不使用Ingress资源的情况下公开Kubernetes服务:

  1. Service.Type=LoadBalancer
  2. Service.Type=NodePort
  3. Port Proxy

答案 2 :(得分:1)

我让它在ingress config中使用这些更改

    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
     name: kube
  namespace: kube-system
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.org/rewrites: "serviceName=kubernetes-dashboard rewrite=/;serviceName=kibana-logging rewrite=/"
spec:
  rules:
  - host: HOSTNAME_OF_MASTER
    http:
      paths:
      - path: /kube-ui/
        backend:
          serviceName: kubernetes-dashboard
          servicePort: 80
      - path: /kibana/
        backend:
          serviceName: kibana-logging
          servicePort: 5601

我的Kibana服务器设置为Nodeport

apiVersion: v1
kind: Service
metadata:
  name: kibana-logging
  namespace: kube-system
  labels:
    k8s-app: kibana-logging
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
    kubernetes.io/name: "Kibana"
spec:
  type: NodePort
  ports:
  - port: 5601
    protocol: TCP
    targetPort: ui
  selector:
    k8s-app: kibana-logging

和仪表板也配置为此

# ------------------- Dashboard Service ------------------- #
kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kube-system
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 9090
  selector:
    k8s-app: kubernetes-dashboard

一旦运行了svc,就可以从任何节点使用NodePort访问kibana。示例:http://node01_ip:31325 / app / kibana

$ kubectl get svc -o wide -n=kube-system
NAME                    TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE       SELECTOR
elasticsearch-logging   ClusterIP   10.xx.120.130   <none>        9200/TCP         11h       k8s-app=elasticsearch-logging
heapster                ClusterIP   10.xx.232.165   <none>        80/TCP           11h       k8s-app=heapster
kibana-logging          NodePort    10.xx.39.255    <none>        5601:31325/TCP   11h       k8s-app=kibana-logging
kube-dns                ClusterIP   10.xx.0.xx       <none>        53/UDP,53/TCP    12h       k8s-app=kube-dns
kubernetes-dashboard    NodePort    10.xx.xx.xx   <none>        80:32086/TCP     11h       k8s-app=kubernetes-dashboard
monitoring-influxdb     ClusterIP   10.13.199.138   <none>        8086/TCP         11h       k8s-app=influxdb