我想使用负载均衡器 IP 向外界公开我的 Prometheus 服务 这是我的清单文件
class Cd_MixedView(UpdateView):
model = Track
template_name = 'cd_mixed_view.html'
form_class = TrackForm
context_object_name = 'cd_edit'
def get_context_data(self, **kwargs):
context = super(Cd_MixedView,self).get_context_data(**kwargs)
cur_track = self.object # no need to get the object again it is already present in `self.object`
# form is already added to context by super method
context['cd_info'] = Cd.objects.get(id=cur_track.cd_id.pk)
return context
# `post`, `form_valid` and `form_invalid` methods were same as super so no need to write yourself
这是我的服务仪表板
这个 34.66.144.24 是我的预留 IPv4
对于这里有一些 IP 的端点,只要我点击 apiVersion: v1
kind: Service
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"prometheus.io/scrape":"true"},"labels":"name":"prometheus","namespace":"istio-system"},"spec":{"ports":[{"name":"http-prometheus","port":9090,"protocol":"TCP"}],"selector":{"app":"prometheus"}}}
prometheus.io/scrape: "true"
creationTimestamp: "2021-04-20T04:05:35Z"
labels:
app: prometheus
install.operator.istio.io/owning-resource: installed-state
install.operator.istio.io/owning-resource-namespace: istio-system
release: istio
managedFields:
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:labels:
.: {}
f:app: {}
f:install.operator.istio.io/owning-resource: {}
f:install.operator.istio.io/owning-resource-namespace: {}
f:spec:
f:ports:
.: {}
k:{"port":9090,"protocol":"TCP"}:
.: {}
f:name: {}
f:port: {}
f:protocol: {}
f:targetPort: {}
manager: istioctl
operation: Update
time: "2021-04-20T04:05:35Z"
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:spec:
f:externalTrafficPolicy: {}
f:loadBalancerIP: {}
f:type: {}
manager: Go-http-client
operation: Update
time: "2021-04-20T05:46:18Z"
name: prometheus
namespace: istio-system
resourceVersion: "71791"
spec:
clusterIP: 172.26.232.117
externalTrafficPolicy: Cluster
loadBalancerIP: 34.66.144.25
ports:
- name: http-prometheus
nodePort: 31057
port: 9090
protocol: TCP
targetPort: 9090
selector:
app: prometheus
sessionAffinity: None
type: LoadBalancer
status:
loadBalancer: {}
,它就会说“无法访问该站点
答案 0 :(得分:0)
请确保没有防火墙阻止外部世界到该地址和端口的流量