DEV Community

Cover image for Deploying a Single-Node Kubernetes Cluster on AWS EC2 with K3s
prokshita nagarajan
prokshita nagarajan

Posted on

Deploying a Single-Node Kubernetes Cluster on AWS EC2 with K3s

Running a full Kubernetes cluster doesn't always mean spinning up multiple nodes. If you're prototyping, running a small production workload, or just want a lightweight environment to learn on, a single EC2 instance running Kubernetes is more than enough — and a lot cheaper.

In this post, I'll walk through the options for running Kubernetes on a single EC2 instance, why I went with K3s, and exactly how to get a working single-node cluster up in under five minutes.

Options for Running Kubernetes on EC2

Before picking a tool, it's worth knowing what's out there:

1] k3s : Single node, lightweight.
2] MicroK8s : Ubuntu-native, addons built-in.
3] Kubeadm : Full control, standard k8s.
4] Kind/Minikube : Local dev only, not for EC2 prod.

Each has a place. kubeadm gives you the full vanilla Kubernetes experience and is the right call if you're planning to scale to multiple nodes later. MicroK8s is a solid choice if you're already in the Ubuntu/Canonical ecosystem and want snap-based add-ons. Kind and Minikube are built for local development and aren't meant for EC2 production use at all.

Why K3s

Since the goal here was a single EC2 instance running a working cluster, K3s was the clear choice:

  • Single command install — literally one line, no multi-step bootstrap process
  • Half the memory footprint of full Kubernetes, so it runs comfortably on smaller instances
  • Production-grade — it's not a toy; K3s is used widely in real-world deployments, including edge and IoT environments
  • Batteries included — containerd, Flannel (CNI), Traefik (ingress), and CoreDNS all ship built-in, so there's nothing extra to install
  • 100% kubectl compatible — every kubectl command, every manifest, every Helm chart works exactly the same as it would on a "real" cluster

Prerequisites

  1. An AWS account
  2. An EC2 instance with:
    • AMI: Ubuntu 22.04 LTS
    • Instance type: t3.medium (2 vCPU, 4GB RAM)
    • Storage: 20GB gp3

Step 1: Install K3s

SSH into your EC2 instance and run:

curl -sfL https://get.k3s.io | sh -
Enter fullscreen mode Exit fullscreen mode

That's the entire installation. Behind the scenes, this single command:

  • Installs containerd as the container runtime
  • Installs the control plane components (API server, controller manager, scheduler)
  • Installs Flannel for pod networking
  • Installs Traefik as the ingress controller
  • Installs CoreDNS for cluster DNS
  • Configures the node to act as both control plane and worker, since this is a single-node setup
  • Registers itself as a systemd service, so it survives reboots

Step 2: Verify the Cluster

Check that the node is up and ready:

sudo kubectl get nodes
Enter fullscreen mode Exit fullscreen mode

You should see a single node in Ready state:

NAME              STATUS   ROLES                  AGE   VERSION
ip-172-31-x-x     Ready    control-plane,master   1m    v1.29.x+k3s1
Enter fullscreen mode Exit fullscreen mode

That's it — you now have a fully functional, kubectl-compatible Kubernetes cluster running on a single EC2 instance, ready to take workloads.

What's Next

From here, the cluster behaves like any other Kubernetes cluster: deploy with manifests, expose services via Traefik ingress, install Helm charts, or wire it into a CI/CD pipeline to pull and run container images from a registry like ECR.

K3s strips away the operational overhead of running Kubernetes without compromising on compatibility — making it the simplest way to get a real cluster running on a single EC2 instance.

Top comments (0)