4 minute read

Version 22.3.0 (and later) of the xl cli comes with the ‘kube’ command: this command enables you to install Release or Deploy in a k8s cluster in less than a few minutes!
For the demo purpose my installation is going to be limited and not production ready: I’ll use the local storage, meaning dynamic provisionning will not be supported: I’ll then be limited to one instance of Release as each instance uses the same PersistentVolumClaim to get storage (otherwise several Release instances would be mounted to the same directory in my k8s node!)

1. Install the xl cli

Follow the offical documentation: Install the XL Cli

Check the version:

➜ xl version
CLI version:             22.3.8
Git version:             v22.3.0-305.100-0-g29ee73e
API version XL Deploy:   xl-deploy/v1
API version XL Release:  xl-release/v1
Git commit:              29ee73ec986e20ead666bae45bd2dc41cd5e6adf
Build date:              2023-03-06T13:19:35.451Z
GO version:              go1.16
OS/Arch:                 darwin/amd64

2. Install and configure your k8s cluster

In this article I’m going to use a simple 2 nodes k8s cluster (kubemaster, kubenode01) created using the steps described in my article “Local k8s cluster”.

During the installation I install PostgreSQL, RabbitMQ and Release, so I need 3 PersistentVolume. I use local persistent storage.
My default k8s cluster does not come with any StorageClass or PersistentVolume. Add a storage class if necessary:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer

Then 3 local persistent volumes (pv1, pv2, pv3): (see kubernetes.io doc))

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv1
spec:
  capacity:
    storage: 2Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Delete
  storageClassName: local-storage
  local:
    path: /data/volumes/pv1
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - kubenode01
...

3. Run the “xl kube install” command

For a basic installation, the answers to the command are quite straightforward. Below is the result of the execution of the command. I choose 1Gi for each storage and 1 replica for Release and RabbitMQ.

➜ xl kube install
....
? Provide PVC size for RabbitMQ (Gi): 1
	 -------------------------------- ----------------------------------------------------
	| LABEL                          | VALUE                                              |
	 -------------------------------- ----------------------------------------------------
	| AccessModeRelease              | ReadWriteOnce                                      |
	| AdminPassword                  | admin                                              |
	| CleanBefore                    | false                                              |
	| CreateNamespace                | true                                               |
	| EnablePostgresql               | true                                               |
	| EnableRabbitmq                 | true                                               |
	| ExternalOidcConf               | external: false                                    |
	| GenerationDateTime             | 20230315-144539                                    |
	| ImageNameRelease               | xl-release                                         |
	| ImageTag                       | 22.3.8                                             |
	| IngressType                    | none                                               |
	| K8sSetup                       | PlainK8s                                           |
	| KeystorePassphrase             | FMS0j3EQYT3JFvBb                                   |
	| License                        | LS0tIExpY2Vuc2UgLS0tCkxpY2Vuc2UgdmVyc2lvbjogMwpQ.. |
	| LicenseFile                    | /Users/sblin/Documents/Demos_Products/XLRelease/.. |
	| LicenseSource                  | file                                               |
	| OidcConfigType                 | no-oidc                                            |
	| OidcConfigTypeInstall          | no-oidc                                            |
	| OperatorImageReleaseGeneric    | xebialabs/release-operator:22.3.8                  |
	| OsType                         | darwin                                             |
	| PostgresqlPvcSize              | 1                                                  |
	| PostgresqlStorageClass         | local-storage                                      |
	| ProcessType                    | install                                            |
	| PvcSizeRelease                 | 1                                                  |
	| RabbitmqPvcSize                | 1                                                  |
	| RabbitmqReplicaCount           | 1                                                  |
	| RabbitmqStorageClass           | local-storage                                      |
	| RepositoryKeystoreSource       | generate                                           |
	| RepositoryName                 | xebialabs                                          |
	| ServerType                     | dai-release                                        |
	| ShortServerName                | xlr                                                |
	| StorageClass                   | local-storage                                      |
	| UseCustomNamespace             | false                                              |
	| XlrReplicaCount                | 1                                                  |
	 -------------------------------- ----------------------------------------------------
? Do you want to proceed to the deployment with these values? (Y/n)

After a few minutes the pods will be up and running.

To check the installationn run:

➜ xl kube check
...
Waiting for resources to be ready
Deployment deployment/xlr-operator-controller-manager is available in the namespace digitalai
PVC pvc/data-dai-xlr-rabbitmq-0 is bound in the namespace digitalai
Pod pod/dai-xlr-rabbitmq-0 is available in the namespace digitalai
PVC pvc/data-dai-xlr-postgresql-0 is bound in the namespace digitalai
Pod pod/dai-xlr-postgresql-0 is available in the namespace digitalai
PVC pvc/dai-xlr-digitalai-release is bound in the namespace digitalai
Pod pod/dai-xlr-digitalai-release-0 is available in the namespace digitalai
Checking helm installation status
Operator's dai-xlr helm status in the namespace digitalai for the installation:
NAME: dai-xlr
LAST DEPLOYED: Wed Mar 15 13:51:53 2023
NAMESPACE: digitalai
STATUS: deployed
REVISION: 5
TEST SUITE: None
NOTES:
## To get the application URL, run:

## To get the admin password for xl-release, run:
kubectl get secret --namespace digitalai dai-xlr-digitalai-release -o jsonpath="{.data.release-password}" | base64 --decode; echo

## To get the password for postgresql, run:
kubectl get secret --namespace  digitalai dai-xlr-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode; echo

## To get the password for rabbitMQ, run:
kubectl get secret --namespace  digitalai dai-xlr-rabbitmq   -o jsonpath="{.data.rabbitmq-password}" | base64 --decode; echo

## To edit custom resource dai-xlr
kubectl edit digitalaireleases.xlr.digital.ai dai-xlr -n digitalai

## To restart release pods use restart of the statefulset
kubectl rollout restart sts dai-xlr-digitalai-release -n digitalai

Check finished successfully!

4. The “xl kube” in details

See the official documentation for more details on the command and specifically for the details of all the files and folders that have been created in the directory where you ran the command!

5. Conclusion:

For demo purpose, it’s very easy to install Release on a k8s cluster. For a production environment, it must be carefully planned. Do not hesitate to contact Digital.ai Professional Services to help you for the installation.