Skip to main content

Operators

For organizational purposes we want to have our operators running in a single namespace and managing apps in other namespaces.

create operator namespace
kubectl create namespace operators
danger

Please note that all version described here are subject to changes. Please verify if the version described here coincides with the desired version.

PGO Operator (Crunchy Data) 5.2.0

The Crunchy data operator or PGO is a postgres operator that allows us to easily create and manage postgres instances.

PGO has already been forked for you and all we need to do is download the repository and run the predefined coding.

download repo
git clone https://github.com/nimbit-software/crunch-data-pgo.git

cd crunch-data-pgo

Once in the repository we can execute the kustomize command to set up the operator.

set up operator
# only needed if the namespace was not yet created
kubectl apply -k kustomize/install/namespace
kubectl apply --server-side -k kustomize/install/default

This will create a namespace called operators (if not exists) and create all of the objects required to deploy PGO.

To check on the status of your installation, you can run the following command:

kubectl -n operators get pods \
--selector=postgres-operator.crunchydata.com/control-plane=postgres-operator \
--field-selector=status.phase=Running

If the PGO Pod is healthy, you should see output similar to:

NAME                                READY   STATUS    RESTARTS   AGE
postgres-operator-9dd545d64-t4h8d 1/1 Running 0 3s

Before creating a postgres cluster we will first create the other operators. All the PGO docs can be found here

info

It would be a very good idea to install the PGO monitoring tools to be able to keep an eye on the database and what is going on

From the existing crunchy git repo we can run:

PGO monitoring
kubectl apply -k kustomize/monitoring

This will spin up the monitoring tools including the grafana dashboards.

Keycloak Operator V20

The keycloak operators allows us to manage keycloak instances. It will spin up and monitor all the resources need for the keycloak environment.

To install the operator on a Kubernetes cluster, you first need to install its CRDs by running the following commands:

Keycloak CRD
kubectl apply -f https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/20.0.0/kubernetes/keycloaks.k8s.keycloak.org-v1.yml

kubectl apply -f https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/20.0.0/kubernetes/keycloakrealmimports.k8s.keycloak.org-v1.yml

Now that we have the CRDs defined lets start setup the operator:

kubectl apply -f https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/20.0.0/kubernetes/kubernetes.yml -n operators

Now let verify its running:

kubectl -n operators get pods   --selector=app.kubernetes.io/name=keycloak-operator   --field-selector=status.phase=Running

You should see something like:

NAME                                READY   STATUS    RESTARTS   AGE
keycloak-operator-fdc587f46-k5tlj 1/1 Running 0 105s
nning

Great we got that one going now lets move on to the next one

Redis

Redis our wonderful cache engine. Where would we be without it. I don't want to know. Lets get the operator running.

Thankfully we can you helm for that:

Redis
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/

helm upgrade redis-operator ot-helm/redis-operator \
--install --namespace operators

And now for our check:

kubectl -n operators get pods  -l name=redis-operator   --field-selector=status.phase=Running

And we should expect to see something like:

NAME                              READY   STATUS    RESTARTS   AGE
redis-operator-7899446668-vjddp 1/1 Running 0 5m5s

Closing

We are all set up. If you get stuck please refer to the official docs provided by the different operator providers