Microk8s prometheus operator

microk8s enable prometheus

如果安装过程中报错,尝试删除相关文件夹

sudo rm -rf /var/snap/microk8s/2262/kube-prometheus

使用 kubectl port-forward 登入

microk8s kubectl port-forward grafana-6b8df57c5b-z626n 3000:3000 -n monitoring

输入系统刚才提示的密码

admin/admin

创建一个 nodeport

kind: Service
apiVersion: v1
metadata:
  name: grafananp
  namespace: monitoring
  labels:
    app: grafana
spec:
  ports:
    - name: http
      protocol: TCP
      port: 3000
      targetPort: 3000
      nodePort: 30036
  selector:
    app: grafana
  type: NodePort
  sessionAffinity: None
  externalTrafficPolicy: Cluster
Send a Message