Quickstart: Auto generating Kubernetes Manifests with K8s Initializer

Michael Levan - Jul 13 '22 - - Dev Community

Creating and managing Kubernetes Manifests can be a pain and let’s be honest, no one actually ever remembers the syntax of a Manifest without either looking at one they already created or Googling it. Because the idea of memorizing every list, map, and style of configuration for a Manifest isn’t exactly necessary, you can automate the process. Although there are a few different ways to do this, a popular choice within the engineering community is K8s Initializer by Ambassador Labs.

In this blog post, you’ll learn what K8s Initializer is and how to get started with it.

What Is K8s Initializer

The idea behind K8s Initializer is to have a production-level Kubernetes environment that is built in an automatic fashion. When you’re building a Kubernetes environment, there’s a lot of configuration that needs to happen to get it production-ready. Although K8s Initialize doesn’t cover everything you need for a production-ready environment, it does cover a lot of the important aspects of a production environment including:

  • Observability
  • Knative if you want Serverless
  • ArgoCD
  • Consul for Service Mesh
  • Ambassador Edge Stack for Ingress
  • Keycloak for Auth

For example, there’s an option to enable ArgoCD if you want to run a GitOps workflow.

Underneath the hood, K8s Initializer is essentially creating a bunch of Custom Resource Definitions (CRD) to extend the Kubernetes API to use the tools listed on the K8s Initializer setup page, like ArgoCD and Prometheus.

Image description

The goal with K8s Initializer is to save you time. For example, the screenshot below shows an output that tells you how many lines of YAML you’d have to write to get the same configuration you get from K8s Initializer if you didn’t use it.

Image description

Getting Started With K8s Initializer

Now that you know what K8s Initializer is and its purpose, let’s learn how to use it in a step-by-step fashion.

  1. Go to https://app.getambassador.io/initializer

You’ll come up to a page similar to the screenshot below.

Image description

  1. You’ll have a few options to choose from, including where your Kubernetes cluster is located and other production-ready settings.

Image description

  1. For simplicity, use the dropdown under Step 1 and choose Minikube along with selecting No, don’t terminate TLS.

Image description

  1. Depending on your use case, there are several options around observability, automation, and security. Feel free to pick and choose if you’d like any of these options, or skip doing it to keep the configuration simple.

Image description

  1. Click the blue Review and Install button.

Image description

  1. You’ll see several options on how to install the Kubernetes Manifest, including:
    1. From Ambassador via kubectl apply
    2. From Helm
    3. By downloading the Kubernetes Manifest manually and running it from localhost

Image description

Image description

Looking at the Kubernetes Manifest files, you can see the underlying code of what K8s Initializer creates. For example, below is a screenshot of it creating a Deployment for Consul Service Mesh.

Image description

Congrats! You've officially auto-generated a Kubernetes Manifest with K8s Initializer.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .