New to Kubed? Please start here.

Monitoring Kubed

Kubed operator exposes Prometheus ready metrics via the following endpoints on port :8443:

  • /metrics: Scrape this to monitor operator.

Follow the steps below to view the metrics:

  1. Give system:anonymous user access to /metrics url. This is not safe to do on a production cluster.

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
    name: appscode:system:metrics-collector
    rules:
    - nonResourceURLs: ["/metrics"]
    verbs: ["get"]
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
    name: appscode:system:metrics-collector
    roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: ClusterRole
    name: appscode:system:metrics-collector
    subjects:
    - apiGroup: rbac.authorization.k8s.io
    kind: User
    name: system:anonymous
    
    $ kubectl auth reconcile -f docs/examples/monitoring/metrics-collector.yaml
    clusterrole.rbac.authorization.k8s.io "appscode:system:metrics-collector" reconciled
    clusterrolebinding.rbac.authorization.k8s.io "appscode:system:metrics-collector" reconciled
    
  2. Now, forward the port :8443 to your workstation.

    $ kubectl get pods -n kube-system | grep voyager
    voyager-operator-f89dcccdb-plvmt        1/1       Running   0          27m
    
    $ kubectl port-forward -n kube-system voyager-operator-f89dcccdb-plvmt 8443
    Forwarding from 127.0.0.1:8443 -> 8443
    Forwarding from [::1]:8443 -> 8443
    
  3. Now, visit the url: https://127.0.0.1:8443/metrics

operator-metrics

  1. Once you are done, remove access to system:anonymous user.

    $ kubectl delete -f docs/examples/monitoring/metrics-collector.yaml
    clusterrole.rbac.authorization.k8s.io "appscode:system:metrics-collector" deleted
    clusterrolebinding.rbac.authorization.k8s.io "appscode:system:metrics-collector" deleted
    

Next Steps

  • Learn how to use Kubed to protect your Kubernetes cluster from disasters here.
  • Need to keep configmaps/secrets synchronized across namespaces or clusters? Try Kubed config syncer.
  • Want to keep an eye on your cluster with automated notifications? Setup Kubed event forwarder.
  • Out of disk space because of too much logs in Elasticsearch or metrics in InfluxDB? Configure janitors to delete old data.
  • Wondering what features are coming next? Please visit here.
  • Want to hack on Kubed? Check our contribution guidelines.