如何使用 ip 地址访问 grafana-istio 仪表板?
How to access grafana-istio dashboard using ip address?
我正在使用 minikube
到 运行 kubernetes 集群。我按照 Istio Docs 中给出的设置来安装 istio 插件。我可以使用 localhost:3000
访问仪表板,但无法使用 ip:3000
访问。
已检查防火墙。它没有阻塞任何端口。
您需要为此创建 grafana 服务类型 NodePort
。您可以使用 $ kubectl edit svc grafana -n istio-system
更改它,并将 .spec.type
从 ClusterIP
更改为 NodePort
,然后保存并退出编辑器。
要访问 grafana $ kubectl get svc grafana -n istio-system
并获取 NodePort
字段然后通过 ip:$NodePortValue
访问它
检查 grafana 服务类型。
您可以使用 NodePort
或 LoadBalancer
作为服务类型。
使用NodePort
的ip或者直接使用LoadBalancer
的IP地址即可访问grafana vai internet在线服务
不幸的是,如果您使用的是 istio
,那么仅更改服务类型并不容易。您必须配置 Istio VirtualService
并创建 Gateway
。
我将此答案作为与另一个堆栈案例相关的社区 Wiki 发布:
如前所述,问题有 1 个反对票,将来可能会被删除,我将发布以供将来在这种情况下使用。
============================================
您可以创建 Istio Gateway and VirtualService 以便默认在端口 3000
上将您的请求转发到 grafana
服务 运行
首先,让我们检查一下grafana
和istio-ingressgateway
服务
kubectl get svc grafana istio-ingressgateway -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
grafana ClusterIP 100.71.67.105 <none> 3000/TCP 18h
istio-ingressgateway LoadBalancer 100.64.42.106 <Public IP address> 15020:31766/TCP,80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:32576/TCP,15030:30728/TCP,15031:31037/TCP,15032:31613/TCP,15443:32501/TCP 18h
因此,我们有 grafana
运行 服务侦听端口 3000,默认 istio-ingressgateway
LoadBalancer 服务 运行 分配 public ip 地址。
然后我们创建gateway
来使用这个默认的LoadBalancer。
$ kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: grafana-gateway
namespace: istio-system # Use same namespace with backend service
spec:
selector:
istio: ingressgateway # use Istio default gateway implementation
servers:
- port:
number: 80
name: HTTP
protocol: HTTP
hosts:
- "*"
EOF
然后为通过此网关进入的流量配置到 grafana service
的路由:
$ kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: grafana
namespace: istio-system # Use same namespace with backend service
spec:
hosts:
- "*"
gateways:
- grafana-gateway # define gateway name
http:
- match:
- uri:
prefix: "/"
route:
- destination:
port:
number: 3000 # Backend service port
host: grafana # Backend service name
EOF
然后点击 http://<public_ip_istio_ingressgateway>
,您应该会看到 grafana 仪表板
希望对你有所帮助
我正在使用 minikube
到 运行 kubernetes 集群。我按照 Istio Docs 中给出的设置来安装 istio 插件。我可以使用 localhost:3000
访问仪表板,但无法使用 ip:3000
访问。
已检查防火墙。它没有阻塞任何端口。
您需要为此创建 grafana 服务类型 NodePort
。您可以使用 $ kubectl edit svc grafana -n istio-system
更改它,并将 .spec.type
从 ClusterIP
更改为 NodePort
,然后保存并退出编辑器。
要访问 grafana $ kubectl get svc grafana -n istio-system
并获取 NodePort
字段然后通过 ip:$NodePortValue
检查 grafana 服务类型。
您可以使用 NodePort
或 LoadBalancer
作为服务类型。
使用NodePort
的ip或者直接使用LoadBalancer
的IP地址即可访问grafana vai internet在线服务
不幸的是,如果您使用的是 istio
,那么仅更改服务类型并不容易。您必须配置 Istio VirtualService
并创建 Gateway
。
我将此答案作为与另一个堆栈案例相关的社区 Wiki 发布:
============================================
您可以创建 Istio Gateway and VirtualService 以便默认在端口 3000
上将您的请求转发到grafana
服务 运行
首先,让我们检查一下grafana
和istio-ingressgateway
服务
kubectl get svc grafana istio-ingressgateway -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
grafana ClusterIP 100.71.67.105 <none> 3000/TCP 18h
istio-ingressgateway LoadBalancer 100.64.42.106 <Public IP address> 15020:31766/TCP,80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:32576/TCP,15030:30728/TCP,15031:31037/TCP,15032:31613/TCP,15443:32501/TCP 18h
因此,我们有 grafana
运行 服务侦听端口 3000,默认 istio-ingressgateway
LoadBalancer 服务 运行 分配 public ip 地址。
然后我们创建gateway
来使用这个默认的LoadBalancer。
$ kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: grafana-gateway
namespace: istio-system # Use same namespace with backend service
spec:
selector:
istio: ingressgateway # use Istio default gateway implementation
servers:
- port:
number: 80
name: HTTP
protocol: HTTP
hosts:
- "*"
EOF
然后为通过此网关进入的流量配置到 grafana service
的路由:
$ kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: grafana
namespace: istio-system # Use same namespace with backend service
spec:
hosts:
- "*"
gateways:
- grafana-gateway # define gateway name
http:
- match:
- uri:
prefix: "/"
route:
- destination:
port:
number: 3000 # Backend service port
host: grafana # Backend service name
EOF
然后点击 http://<public_ip_istio_ingressgateway>
,您应该会看到 grafana 仪表板
希望对你有所帮助