Setup a self-hosted developer platform in minutes with Kubernetes

Pierrick Gicquelais
3 min readJun 24, 2021

--

You want to bootstrap your tech company but you only got 5 minutes? Let’s go!

Photo by Clark Van Der Beken on Unsplash

We will setup a minimalist self-hosted platform for a developer team to start coding and deploying its first applications.

Tl;dr: we will use Kubernetes, Helm, cert-manager, ingress-nginx, Gitlab and ArgoCD.

For the sake of this tutorial, we will assume you already got a Kubernetes cluster working, with at least 2–3 nodes to handle proper orchestration and pod’s requests resources. For simplicity and POC purpose, you might want to use a managed solution like GKE, AWS, or MKS, if you want to try to self-host it, you might want to check Kubernetes the hard-way.

We will setup Gitlab as a VCS to host your repositories, Gitlab Registry for pushing Docker images (use Harbor, if want to manage it through UI), Gitlab Runner for CI (testing your code, packaging your app, …) and ArgoCD for CD (deploying your app in Kubernetes clusters). You will need a domain name with a DNS server to expose your endpoints.

Let’s go!

1. Get helm and update repositories

First, get Helm here and then add required repositories for this tutorial

2. Install cert-manager

We will use cert-manager to enable TLS connections on your final exposed endpoints. You must also configure issuers to launch ACME challenges (here Let’s Encrypt).

3. Install ingress-nginx

To expose your applications, you will have to use an Ingress resource. Using ingress-nginx controller will let you configure hosts and TLS connections easily without having to deep dive into nginx.

Given the IP external adress of your ingress-controller, you should already create new sub zones onto your domain name, such like: gitlab.yourdomain, registry.yourdomain, and argo.yourdomain, all of them doing “A” redirections to this IP.

4. Install Gitlab

Gitlab gives a complete chart with a lot of customization. Although, it also uses its own cert-manager and ingress controller. Since we want them to be used by others (e.g: ArgoCD), we will custom Gitlab to be able to use external components.

Now, you should be able to hit your VCS host on https://gitlab.yourdomain and your container registry on https://registry.yourdomain.
Well done! It’s time for you to setup your first repositories.

5. Install ArgoCD

Finally, we will install our continous delivery tool.

You are now able to hit your best CD platform on https://argo.yourdomain.
It’s time now to link Argo to your gitlab repositories hosting your manifests for deploying your application in multi-stage environments in Kubernetes!

Conclusion

You are now all setup to start working on your fresh self-hosted platform! However, this is NOT production ready, use this as a POC statement. There are still a few things to manage before going to prod:

  • There are NO network policies, nor rbac, nor any kind of security applied in the cluster for connections (you might want to check Dex, for OIDC).
  • You MUST add backups to your provisionned volumes, otherwise, you might loose everything set in your VCS or registry (you might want to check Velero).
  • This is NOT scalable, even though Gitlab comes with horizontal pod scaling, you will not be able to go anywhere further without a proper amount of worker nodes (you might want to check cluster-autoscaler).

Thanks for reading, and have fun using your fresh installed platform :)

--

--