Create a devpod K8S custom provider for EKS

Create a devpod K8S custom provider for EKS

Learn to deploy a devpod in AWS EKS with this guide covering custom pod manifest setup, devcontainer integration, and essential configurations."

Published Jan 20, 2024
You are probably already familiar with devcontainers and how they significantly contribute to the development cycle. Until now, I have used them locally to standardize the technology stack versions within our platform engineering team.
However, what happens when we want to take this to a higher, collaborative level? Indeed, options like GitHub Codespaces can be useful in some scenarios. But what if you need to test APIs hosted in your AWS EKS cluster?
At this point, devpod.sh becomes an essential tool. Next, I will explain how you can deploy a devcontainer in your EKS cluster using devpod.

Prerequisites:

  • Have an AWS EKS Cluster configured.
  • Have access to your AWS EKS cluster.

Devpod Installation

Provider Custom Configuration

Inside that file, I want you to pay attention to INJECT_GIT_CREDENTIALS, KUBERNETES_CONTEXT, KUBERNETES_CONFIG, and POD_MANIFEST_TEMPLATE, where:
  • INJECT_GIT_CREDENTIALS: Injects the local git credentials.
  • KUBERNETES_CONTEXT: Configure the context you are using. Even if you only use the default, I recommend configuring the context name with kubectl config get-contexts.
  • KUBERNETES_CONFIG: The path to the Kubernetes configuration file. For some, like me, it's preferable to have a file per cluster (a matter of preference), but I still recommend this configuration.
  • POD_MANIFEST_TEMPLATE: Going to the next level means you can also customize the pod deployed in your cluster. In my case, as I use Karpenter, I have some formerly called provisioners with specific computing specifications. Here is an example of that configuration:
With this, we force the creation of pods with the label value dedicated to devpod.

Now, let's put it all together.

  • I have uploaded the files to a repository so you can clone the repo and use the manifests with the options that make sense to you.
  • We create the provider.
Confirm that it was added correctly with the command devpod provider list.
  • We create our workspace
We will see how our container has been created. And remember, one of the customizations we made was to specify a NodeAffinity.
And automatically VSCode is open:
Excellent! We now have our devpod running within our EKS cluster.
Happy coding!!!
 

References:

1 Comment