Member-only story

Deploying a Kubernetes Application with Infrastructure as Code (IaC)

Jorge Freitas
6 min readOct 18, 2024
Photo by Ian Taylor on Unsplash

In my previous article, I walked you through getting started with Kubernetes using Minikube for local development. Now, it’s time to take the next step — using Infrastructure as Code (IaC) to deploy a Kubernetes application.

Infrastructure as Code helps you automate and manage Kubernetes resources consistently across environments, whether you’re working locally with Minikube or deploying to the cloud, like Azure Kubernetes Service (AKS). In this tutorial, I’ll show you how to structure your files and deploy a simple Kubernetes application using IaC.

What We’ll Cover

  1. Structuring your project with Kubernetes manifests (YAML files).
  2. Using kubectl to deploy the application locally on Minikube.
  3. Reusing the same IaC files to deploy to AKS (or any other Kubernetes cluster).

The Application: Hello World with agnhost

We’ll use a simple application, agnhost, from the public registry registry.k8s.io/e2e-test-images/agnhost:2.39. This application is great for testing, and it runs a basic HTTP server on port 8080.

1. Structuring Your Project

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

No responses yet

Write a response