在k8smaster节点上重新生成一个alertmanager-svc.yaml文件
cat >alertmanager-svc.yaml <<EOF --- apiVersion: v1 kind: Service metadata: labels: name: prometheus kubernetes.io/cluster-service: 'true' name: alertmanager namespace: monitor-sa spec: ports: - name: alertmanager nodePort: 30066 port: 9093 protocol: TCP targetPort: 9093 selector: app: prometheus sessionAffinity: None type: NodePort EOF#查看service在物理机映射的端口
kubectl get svc -n monitor-sa