Setting up Kubernetes Addons

2023/06/11

circle-info

See the GitHub repo for this post in kengz/k0s-clusterarrow-up-right.

After creating a Kubernetes cluster, we would want to add a set of standard cluster addons using Helmarrow-up-right for DevOps:

Additionally, install Lensarrow-up-right for GUI monitoring and access to the cluster. Get a free license to use.

Installations

cert-manager

Helm chart herearrow-up-right.

cluster-autoscaler

Helm chart herearrow-up-right. This component has some custom settingsarrow-up-right dependending on which cloud provider is used, but the main gist is:

metrics-server

Helm chart herearrow-up-right. Some kubernetes providers have this preinstalled, but the gist is:

kubernetes-dashboard

Manifest herearrow-up-right - this installs more reliably than its Helm chart. First, prepare manifest to create a service account for dashboard access:

Then run:

Preferably, install Lensarrow-up-right for GUI monitoring and access to the cluster (it connects using kubeconfig). Get a free license to use.

Loki

Helm chart herearrow-up-right. Loki is a Grafanaarrow-up-right project for log aggregation - it is scalable (to TBs), cheap, and simple to maintain. The logs will show up in Grafana dashboards - which is a must-have for Kubernetes clusters.

circle-info

Elasticsearch has archived their Helm chartsarrow-up-right and moved to a licensed model (ECK)arrow-up-right, I can no longer recommend it. Also, it is quite bloated and fragile just for log aggregation.

First, prepare the Helm override file to:

We'll also install promtailarrow-up-right as log aggregating agent.

Then run:

circle-info

Grafana dashboard is installed later in kube-prometheus-stack; we will add Loki as a data source to it for log search on Grafana.

kube-prometheus-stack

Helm chart herearrow-up-right. This includes kube-state-metrics, node-exporter, and Grafana: they gather kubernetes metrics from all the cluster nodes, and preconfigure many useful cluster metric dashboards.

Prepare the Helm override file to set/change default password, and add Loki as data source for log search in Grafana:

We will also install 3 additional Helm charts. The first is prometheus-adapterarrow-up-right for custom metrics API, e.g. for HPA to scale using custom-defined metrics.

The second is Prometheus Pushgatewayarrow-up-right, e.g. to push application metrics. Specify Helm override file to configure ServiceMonitor with matching label so it is scraped by kube-prometheus-stack:

The third is Blackbox Exporterarrow-up-right to probe endpoints for uptime monitoring. Specify the Helm override file to configure targets and ServiceMonitor with matching label so it is scraped by kube-prometheus-stack:

Now, install all of these by running:

Grafana Dashboards can also be provisioned via ConfigMaps. See the repo linked above for more examples as the ConfigMap file is large.

Accessing Dashboards

After installing the addons, access all the dashboards as follows:

Lens dashboard
Kubernetes dashboard
One of the many Kubernetes cluster metrics dashboards
Loki Kubernetes Logs dashboard
Grafana
Prometheus targets
circle-info

See the GitHub repo for this post in kengz/k0s-clusterarrow-up-right.

Last updated

Was this helpful?