Installation

Contents

Installation

This section covers the installation of the Enonic XP Kubernetes Operator.

Prerequisites

Kubernetes

A running Kubernetes cluster version 1.17+.

Kubectl

Is the Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. Download it here.

Helm

Is a package manager for Kubernetes. Download it here.

Namespaces

This guide instructs you to install the operator (and potentially the NFS provisioner) into the kube-system namespace. Although this is not a strict requirement, it is best practices to install kubernetes extentions into a namespace that clearly indicates that it has components vital to the system. Since kube-system is present in all clusters and should never be deleted, it is recommended to use that. You can create you own my-system namespace and install the operator there. Do not, for example, install the operator and a XP7 deployment into the same namespace.

Storage classes

Before we deploy the operator, we need to talk about storage classes. That should be a familiar concept to people that have managed Kubernetes clusters before. If you do not know what they are, you can basically think of them as different aproaches to store your data (floppy, HDD, SSD, etc). Each storage class can create volumes that have one of these three access modes:

  • ReadWriteOnce: Can be mounted as read-write by a single node

  • ReadOnlyMany: Can be mounted read-only by many nodes

  • ReadWriteMany: Can be mounted as read-write by many nodes

The reason why we bring this up is because XP, when running in clustered mode, needs shared volumes for some data. If you do not plan on running any XP clusters in your Kubernetes cluster, you are fine and you do not need to worry about storage classes.

However, for XP clusters to work, you need to have a storage class in your cluster that supports creation of ReadWriteMany volumes. For example, the standard storage class in minikube supports all modes, but the standard storage class in GKE does not support ReadWriteMany. You can find a matrix here that shows you different options.

You can create your own storage class with NFS that supports ReadWriteMany access mode. See our NFS storage class guide for more information.

Installation

Helm repository

Start by adding the Enonic repository to Helm and updating repositories:

$ helm repo add enonic https://repo.enonic.com/helm

"enonic" has been added to your repositories
$ helm repo update

Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "enonic" chart repository
Update Complete. ⎈Happy Helming!⎈

Create chart values file

The chart values.yaml file is how you generally configure a deployment with Helm (to learn more about how Helm uses values files, visit the Helm developer docs). You can read more about available values you can configure for the operator in the Helm chart readme. Lets create a Helm values file to configure the operator:

Here you might have to change the storage classes depending on your cluster setup.
values.yaml
config: |-
  # Set storage classes for XP deployments. Note that these two do not have to be the same.
  # The shared storage class has to support ReadWriteMany!
  operator.charts.values.storage.shared.storageClassName=nfs
  operator.charts.values.storage.default.storageClassName=standard

  # Lower default requests: This is useful when trying out XP clusters when
  #   the K8s cluster does not have enough memory and ram!
  operator.charts.values.resources.cpu.defaultRequests=0.2
  operator.charts.values.resources.memory.defaultRequests=512Mi

Installing chart

$ helm upgrade --install \
	--namespace kube-system \
	--version 0.8.0 \
	--values values.yaml \
	enonic-operator \
	enonic/xp-operator

Release "enonic-operator" does not exist. Installing it now.
NAME: enonic-operator
LAST DEPLOYED: Thu Feb 18 16:45:03 2021
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None

Verify installation

First find out the name of the operator pod:

$ kubectl -n kube-system get pods

NAME                                        READY   STATUS              RESTARTS   AGE
coredns-6955765f44-ksgmf                    1/1     Running             0          6m36s
enonic-operator-5869fcf9f4-xrzll            0/1     ContainerCreating   0          10s
etcd-minikube                               1/1     Running             0          6m30s
ingress-nginx-admission-create-zl98b        0/1     Completed           0          6m21s
ingress-nginx-admission-patch-7xqtf         0/1     Completed           2          6m20s
ingress-nginx-controller-7f9bbb757f-nxqz6   1/1     Running             0          6m21s
kube-apiserver-minikube                     1/1     Running             0          6m30s
kube-controller-manager-minikube            1/1     Running             0          6m30s
kube-proxy-f4v7v                            1/1     Running             0          6m36s
kube-scheduler-minikube                     1/1     Running             0          6m30s
nfs-server-nfs-server-provisioner-0         1/1     Running             0          3m40s
storage-provisioner                         1/1     Running             0          6m50s

Then look at the operator logs to see if there are any errors:

$ kubectl -n kube-system logs -f enonic-operator-5869fcf9f4-xrzll

exec java -Doperator.charts.path=helm -Djava.util.logging.manager=org.jboss.logmanager.LogManager -javaagent:/opt/agent-bond/agent-bond.jar=jmx_exporter{{9779:/opt/agent-bond/jmx_exporter_config.yml}} -XX:+ExitOnOutOfMemoryError -cp . -jar /deployments/quarkus-run.jar
__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2021-03-05 12:26:33,130 INFO  com.eno.kub.ope.Operator - Starting api and other components
2021-03-05 12:26:33,532 INFO  io.quarkus - operator 0.16.0 on JVM (powered by Quarkus 1.12.0.Final) started in 1.978s. Listening on: https://0.0.0.0:8443
2021-03-05 12:26:33,535 INFO  io.quarkus - Profile prod activated.
2021-03-05 12:26:33,535 INFO  io.quarkus - Installed features: [cdi, kubernetes-client, rest-client, resteasy, resteasy-jackson]
2021-03-05 12:26:43,139 INFO  com.eno.kub.ope.Operator - Starting schedules and other components
2021-03-05 12:26:43,141 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorDomainCertSync'
2021-03-05 12:26:43,147 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorIngressLabel'
2021-03-05 12:26:43,148 INFO  com.eno.kub.ope.Operator - Adding schedule 'OperatorIngressLabel' [delay: 6996, period: 60000]
2021-03-05 12:26:43,164 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorIngressCertSync'
2021-03-05 12:26:43,164 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorIngress'
2021-03-05 12:26:43,166 INFO  com.eno.kub.ope.Operator - Adding schedule 'OperatorXp7ConfigSync' [delay: 3243, period: 60000]
2021-03-05 12:26:43,169 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorXp7AppInstaller'
2021-03-05 12:26:43,169 INFO  com.eno.kub.ope.Operator - Adding schedule 'OperatorXp7AppInstaller' [delay: 4856, period: 60000]
2021-03-05 12:26:43,177 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorXp7AppStartStopper'
2021-03-05 12:26:43,178 INFO  com.eno.kub.ope.Operator - Adding schedule 'OperatorXp7AppStartStopper' [delay: 5026, period: 60000]
2021-03-05 12:26:43,179 INFO  com.eno.kub.ope.Operator - Adding schedule 'OperatorXp7AppStatus' [delay: 8770, period: 60000]
2021-03-05 12:26:43,182 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorXp7Config'
2021-03-05 12:26:43,184 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorConfigMapEvent'
2021-03-05 12:26:43,185 INFO  com.eno.kub.ope.Operator - Adding schedule 'OperatorConfigMapSync' [delay: 3679, period: 60000]
2021-03-05 12:26:43,186 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorXp7ConfigStatus'
2021-03-05 12:26:43,186 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorDeleteAnnotation'
2021-03-05 12:26:43,186 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorXp7DeploymentHelm'
2021-03-05 12:26:43,189 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorXp7DeploymentStatus'
2021-03-05 12:26:43,191 INFO  com.eno.kub.ope.Operator - Adding schedule 'OperatorXp7DeploymentStatus' [delay: 1975, period: 60000]
2021-03-05 12:26:43,200 INFO  com.eno.kub.ope.Operator - Adding listener 'OperatorXpClientCacheInvalidate'
2021-03-05 12:26:43,200 INFO  com.eno.kub.ope.Operator - Starting informers

Contents