Skip to main content

Quick Start

One of the most powerful features of Kratix is its ability to handle requests for Resources, and deploy them to a specific remote location, Kubernetes or otherwise. However, Kratix also works well in a single Kubernetes cluster environment. This quick-start guide will walk you through the steps to install Kratix on a single cluster.

Prerequisite: Kubernetes cluster

Kratix requires a Kubernetes cluster to run. If you don't already have a cluster, we recommend starting with a local cluster tool like KinD or minikube.

cert-manager

Kratix requires cert-manager to be installed in the cluster.

To install it, run:

kubectl apply --filename https://github.com/cert-manager/cert-manager/releases/download/v1.15.0/cert-manager.yaml

Make sure that cert-manager is ready before installing Kratix:

$ kubectl get pods --namespace cert-manager
NAME READY STATUS RESTARTS AGE
cert-manager-7476c8fcf4-r8cnd 1/1 Running 0 19s
cert-manager-cainjector-bdd866bd4-7d8zp 1/1 Running 0 19s
cert-manager-webhook-5655dcfb4b-54r49 1/1 Running 0 19s

1. Install Kratix

Install Kratix and its Dependencies with the command below:

kubectl apply --filename https://github.com/syntasso/kratix/releases/latest/download/install-all-in-one.yaml

The above will install Kratix, MinIO, and a GitOps agent. MinIO will be the State Store for the Kratix to write to and the GitOps agent will watch the MinIO Bucket for any changes that need to be applied to the cluster. Kratix supports a variety of State Stores and multiple different State Stores can be used.

The GitOps agent installed as part of the quick start is FluxCD. However, any GitOps tool that supports reconciling documents from a Git repository can be used, such as ArgoCD. See the installation documentation for more information on setting up ArgoCD.

You can also install Kratix via Helm. For more information, see the Helm Chart documentation.

Configure

Once Kratix is installed, you can register Kubernetes clusters where workloads should run. On single cluster installations, the same cluster performs the role of the Platform and the worker clusters. The commands below will register the cluster as a Destination, as well as configure FluxCD to watch for the cluster's State Store:

kubectl apply --filename https://github.com/syntasso/kratix/releases/latest/download/config-all-in-one.yaml

Once the system reconciles, the Kratix resources should now be visible on your cluster. You can verify its readiness by observing the kratix-worker-system namespace appearing in the cluster (it may take a couple of minutes):

$ kubectl get namespace kratix-worker-system
NAME STATUS AGE
kratix-worker-system Active 1m

2. Provide Postgres-as-a-Service via a Kratix Promise

Install the sample Postgres Promise with the command below:

kubectl apply --filename https://raw.githubusercontent.com/syntasso/promise-postgresql/main/promise.yaml

Installing the Promise will eventually start the Postgres Operator on your cluster. You can verify by running:

kubectl get pods

It may take a few seconds, but you should eventually see something similar to:

NAME                                 READY   STATUS    RESTARTS   AGE
postgres-operator-7dccdbff7c-2hqhc 1/1 Running 0 1m

3. Self serve a Postgres

Once the Postgres Operator is up and running, you can request a new Postgres Resource with the command below:

kubectl apply --filename https://raw.githubusercontent.com/syntasso/promise-postgresql/main/resource-request.yaml

You can verify the Pipeline pod by running:

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
configure-pipeline-postgresql-default-8f012 0/1 Completed 0 72s
postgres-operator-6c6dbd4459-pbcjp 1/1 Running 0 6m55s

Eventually, the Postgres pods will come up as well:

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
acid-example-postgresql-0 1/1 Running 0 113s
postgres-operator-6c6dbd4459-pbcjp 1/1 Running 0 6m55s
configure-pipeline-postgresql-default-8f012 0/1 Completed 0 2m17s

You are now ready to use your Postgres Resources! To validate, you can run:

kubectl exec -it acid-example-postgresql-0 -- sh -c "
PGPASSWORD=$(kubectl get secret postgres.acid-example-postgresql.credentials.postgresql.acid.zalan.do -o 'jsonpath={.data.password}' | base64 -d) \
PGUSER=$(kubectl get secret postgres.acid-example-postgresql.credentials.postgresql.acid.zalan.do -o 'jsonpath={.data.username}' | base64 -d) \
psql bestdb"

Clean up

To clean up the created resources, run:

kubectl delete --filename https://raw.githubusercontent.com/syntasso/promise-postgresql/main/promise.yaml
kubectl delete --filename https://github.com/syntasso/kratix/releases/latest/download/install-all-in-one.yaml

🎉 Congratulations!

You have successfully installed Kratix and used it to deliver Postgres-as-a-Service to your platform. Check out our guides to learn more about Kratix capabilities.