Member-only story

Deploying a Local C# API to Kubernetes with Minikube and Docker

Jorge Freitas
6 min readOct 19, 2024

--

Photo by Growtika on Unsplash

In this article, we’ll walk through the steps to deploy a simple C# API to a local Kubernetes cluster using Minikube. Unlike the previous example where we used a pre-existing container image, this time we’ll create and deploy our own ASP.NET Core API with a locally built Docker image, without uploading it to a container registry.

By the end of this guide, you’ll be able to:

  • Create a simple C# API.
  • Build a Docker image locally.
  • Deploy the API using Kubernetes.
  • Use Minikube to run the app locally.

Let’s dive in!

Prerequisites

  • Minikube installed and running.
  • Docker installed.
  • Kubectl installed.
  • .NET SDK for C#.

Check my previous articles if you have any doubts about this step.

Project Structure

Start by creating the necessary files and organizing them into a directory structure for better management:

LocalCSharpK8sAPI/                    # Root directory of the project
├── IaC/ # Infrastructure as Code (IaC) folder
│ ├── deployment.yaml…

--

--

No responses yet