// Why this matters
EKS monitoring with Prometheus and Grafana is the first thing a team asks for after the cluster is up, and the thing most often bolted on in a hurry. A cluster you cannot see is a cluster you cannot operate: pods restart, nodes fill up and nobody knows until a user complains.
The second motivation is packaging. Several of the workloads we containerised were .NET and Node services that had only ever run on VMs. Moving them to Kubernetes without a consistent chart layout means every service reinvents probes, resources and metrics. A small shared pattern pays off immediately.
// The problem
A fresh EKS cluster gives you a control plane and nodes, but not much else. Persistent volumes do not work until the EBS CSI driver is installed with the right IAM role, kubectl top fails without metrics-server and there is no metrics pipeline at all. Teams often discover this when Grafana's pod sits in Pending with an unbound volume claim.
Hand-rolled monitoring manifests are the other trap. Copying a Grafana deployment from a blog post gets a dashboard on screen, but without service discovery, alert rules or node exporters it is a demo, not monitoring. Exposing Grafana with a public LoadBalancer and the default admin login is worse than having none.
Finally, application teams need a contract. If scraping requires editing a central Prometheus configmap, the platform team becomes a bottleneck and mistakes break everyone's metrics.
// The solution
Terraform owns the infrastructure: VPC, cluster, a managed node group across private subnets, the OIDC provider for IRSA and an IAM role for the EBS CSI driver. Add-ons are installed as managed EKS add-ons so AWS handles their versions. Terraform stops at the cluster boundary; workloads are installed with Helm.
Monitoring is the kube-prometheus-stack chart. It bundles the Prometheus Operator, Prometheus, Alertmanager, Grafana, kube-state-metrics, node exporter and a library of dashboards and rules. The operator turns ServiceMonitor and PrometheusRule custom resources into scrape config, which is the contract application teams use. I rejected maintaining individual charts for each component: the version matrix is exactly the work this chart already does.
Persistence matters for Prometheus because losing the TSDB on a reschedule means losing history. Both Prometheus and Grafana use gp3 volumes through a dedicated StorageClass. Grafana's admin credentials come from a Kubernetes secret created out of band, never from values committed to git.
Application charts follow one skeleton: Deployment with resource requests and probes, Service, optional HPA and a ServiceMonitor that selects the service by label. For .NET apps we expose metrics with the prometheus-net library; for Node apps with prom-client. Access to Grafana is kubectl port-forward for engineers, with an ingress behind SSO as the next step.
- TerraformVPC, EKS control plane, managed node group
- Add-onsEBS CSI driver with IRSA, CoreDNS, kube-proxy
- metrics-serverenables kubectl top and the HPA
- Cluster access gate gatekubeconfig issued only after IAM mapping is verified
- Helm installkube-prometheus-stack into monitoring namespace
- App chartDeployment, Service, HPA, ServiceMonitor
- ScrapePrometheus discovers the target via labels
- DashboardsGrafana shows cluster and app panels
// Before you start
- Terraform 1.5 or newer, AWS provider 5.x, kubectl 1.29 or newer and Helm 3.14 or newer
- AWS account with permission to create EKS, EC2, IAM and VPC resources
- A VPC with private subnets in at least two zones, or use the community VPC module as shown
- An application image in a registry the nodes can pull from
- Familiarity with Kubernetes Deployments, Services and namespaces
// Step-by-step implementation
01 Provision the EKS cluster with Terraform
Use the community EKS module so IRSA, the OIDC provider and node group wiring are handled for you. Keep the control plane endpoint private if your CI runs in the VPC; otherwise restrict public access to known CIDR ranges.
Pin the Kubernetes version explicitly. Letting it float means a plan that upgrades the control plane by surprise.
02 Give the EBS CSI driver its IAM role
Without this role the driver installs but cannot create volumes, and PVCs hang in Pending with an error that only shows up in the driver logs. IRSA binds an IAM role to the driver's service account through the cluster OIDC provider, so no node-wide permissions are needed.
03 Install metrics-server
metrics-server powers
kubectl topand the horizontal pod autoscaler. It is separate from Prometheus: it serves the resource metrics API from kubelet data and holds only the latest sample. You need both.04 Install kube-prometheus-stack with persistent storage
Values live in git, secrets do not. Retention is set by time and size so the volume cannot fill and crash Prometheus.
serviceMonitorSelectorNilUsesHelmValues: falsemakes Prometheus pick up ServiceMonitors from every namespace rather than only those labelled with the release name, which is what application teams expect.Create the Grafana admin secret first and reference it by name.
05 Reach Grafana without exposing it
Port-forward is enough for engineers and keeps the attack surface at zero. When you need shared access, put an ingress behind your identity provider rather than a public LoadBalancer with a shared login.
The chart provisions Prometheus as a data source and imports dashboards for nodes, pods, namespaces and the control plane, so there is something useful on screen immediately.
06 Package an application as a Helm chart with metrics
This is the reusable skeleton for .NET and Node services. The chart needs probes, resource requests (the HPA computes utilisation against requests, so omitting them breaks autoscaling) and a ServiceMonitor guarded by a flag so it can be disabled in clusters without the operator CRDs.
The service port is named
httpso the ServiceMonitor can select it by name rather than number.07 Autoscale on CPU and alert on the app
Add an HPA that targets CPU utilisation, then a PrometheusRule so the platform tells you when the app is unhealthy rather than waiting for a complaint. Start with two alerts: high error ratio and pods restarting repeatedly. More alerts can wait until you know which ones people act on.
// How to verify it works
- Run
kubectl get nodesand confirm all nodes are Ready, thenkubectl top nodesreturns CPU and memory. - Run
kubectl -n monitoring get pvcand confirm every claim is Bound to a gp3 volume. - Port-forward Grafana, log in and open the Kubernetes compute resources dashboard; confirm data for your namespaces.
- Port-forward Prometheus on 9090, open Status then Targets and confirm your app target is UP.
- Generate CPU load against the app and confirm
kubectl get hparaises the replica count.
// Design decisions and trade-offs
- Provision the cluster with Terraform and managed node groups, and install add-ons as EKS add-ons where available
- Use kube-prometheus-stack rather than hand-assembling Prometheus, Alertmanager and exporters
- Back Prometheus and Grafana with gp3 volumes through the EBS CSI driver using IRSA
- Package each workload as a Helm chart with a ServiceMonitor so metrics are discovered automatically
- Keep Grafana private behind port-forward or an authenticated ingress instead of a public LoadBalancer
// Pitfalls and lessons learned
- Installing the EBS CSI add-on without an IRSA role leaves PVCs Pending; check the controller logs, not the PVC events.
- Prometheus ignores ServiceMonitors without the right labels unless the selector-nil value is set to false.
- Helm does not upgrade CRDs; skipping the manual CRD step causes failures after chart upgrades.
- An HPA without resource requests shows unknown utilisation and never scales.
- Retention by time only can still fill the disk; always set a size limit below the volume.
- A public LoadBalancer for Grafana with default credentials is the most common exposed-monitoring incident.
- Using
latestimage tags makes rollbacks impossible and hides which version is behind an alert.
// Frequently asked questions
How do I monitor an EKS cluster with Prometheus and Grafana?
Install the kube-prometheus-stack Helm chart into a monitoring namespace with persistent volumes, then add ServiceMonitor resources for your applications. Grafana is preconfigured with the Prometheus data source and cluster dashboards.
Do I need metrics-server if I have Prometheus?
Yes for kubectl top and the HPA. Prometheus stores history; metrics-server serves the live resource metrics API.
Should I use Amazon Managed Prometheus instead?
It removes storage and scaling work and is a good fit for larger fleets. Self-hosted is simpler to start and cheaper for one cluster; the ServiceMonitor contract is the same.
How do I scrape a .NET app?
Expose metrics with the prometheus-net library at /metrics and add a ServiceMonitor selecting the service port. Node apps use prom-client.
How is this different from the platform clusters elsewhere on this site?
Those are multi-cluster and GitOps-driven, see Who Deploys the Deployer? Terraform-Bootstrapped FluxCD and Terraform Platform: EKS, Aurora, OpenSearch, DynamoDB and Lambda. This one is the minimal single-cluster version.
// The outcome
A cluster that reports on itself from day one: node and pod metrics, ready-made dashboards and a repeatable chart layout for .NET and Node services. New workloads join monitoring by shipping a ServiceMonitor rather than by someone editing Prometheus config.
// Where to take it next
- Add an authenticated ingress for Grafana and alert routing to chat or paging.
- Move releases to GitOps following Who Deploys the Deployer? Terraform-Bootstrapped FluxCD.
- Ship logs with Fluent Bit alongside metrics.
- Add cost and capacity dashboards and right-size node groups from real data.