cloudify-manager-worker

by longtian

Helm chartv0.4.9

Cloudify manager worker

About this chart

Cloudify manager worker helm chart ( Premium Version )

Description

It's a helm chart for cloudify manager which:

  • Is highly available, can be deployed with multiple replicas. ( available only when used NFS like Storage file system )
  • Uses persistent volume to survive restarts/failures.
  • Uses DB (PostgreSQL), which may be deployed as a dependency automatically (also possible to use external postgresql).
  • Uses Message Brokers (rabbitMQ), which may be deployed as a dependency automatically.

This is how the setup looks after it's deployed to 'cfy-example' namespace (it's possible to have multiple replicas (pods) of cloudify manager):

Prerequisites

  • Docker installed
  • Kubectl installed
  • Helm installed
  • Running Kubernetes cluster (View differences between cloud providers)
    • EKS on AWS
    • AKS on Azure
    • GKE on GCP
  • Sufficient Kubernetes node Minimum Requirements
  • Cloudify Premium valid license (for Premium version)

How to create and deploy such a setup?

  1. Generate certificate as a secret in k8s.

  2. Deployment of Cloudify manager worker with dependencies.

  3. (Optional) Ensure UI access to the manager upon installation

  4. (Optional) Extra configuration options

  5. Troubleshooting

  6. Uninstallation of helm charts

You need to deploy DB and Message Broker before deploying Cloudify manager worker

Generate certificates and add as secret to k8s

SSL certificate must be provided, to secure communications between cloudify manager and posrgress/rabbitmq

  • ca.crt (to sign other certificates)

  • tls.key

  • tls.crt

Option 1: Automatically generate certificates by cert-manager component installed to kubernetes cluster

Cert-manager (https://cert-manager.io) should be previously installed into your k8s cluster for that!

This feature is disabled by default in helm chart, you can enable it if you add to your helm values file:

tls:
  certManager:
    generate: true

NOTE: Secrets, generated by cert-manager won't be removed automatically if you uninstall helm release and can be re-used later.

Option 2: Create certificates using the community cloudify manager docker container

$ docker pull cloudifyplatform/community-cloudify-manager-aio:latest
$ docker run --name cfy_manager_local -d --restart unless-stopped --tmpfs /run --tmpfs /run/lock cloudifyplatform/community-cloudify-manager-aio

Exec to the manager and generate certificates

$ docker exec -it cfy_manager_local bash

# NAMESPACE to which cloudify-manager deployed, must be changed accordingly
$ cfy_manager generate-test-cert -s 'cloudify-manager-worker.NAMESPACE.svc.cluster.local,rabbitmq.NAMESPACE.svc.cluster.local,postgres-postgresql.NAMESPACE.svc.cluster.local,localhost'

You can change the name of the created certificates (inside the container):

$ cd /root/.cloudify-test-ca
$ mv cloudify-manager-worker.helm-update.svc.cluster.local.crt tls.crt
$ mv cloudify-manager-worker.helm-update.svc.cluster.local.key ./tls.key

Exit the container and copy the certificates from the container to your working environment:

$ docker cp cfy_manager_local:/root/.cloudify-test-ca/. ./

Create secret in k8s from certificates:

$ kubectl create secret generic cfy-certs --from-file=./tls.crt --from-file=./tls.key --from-file=./ca.crt -n NAMESPACE

Option 3: Use cert-manager component installed to kubernetes cluster (manually)

You need to deploy those manifests, which will generate cfy-certs secret eventually, you need to change NAMESPACE to your namespace before. You can find this manifest in external folder - cert-issuer.yaml

apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: selfsigned-issuer
spec:
  selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: cfy-ca
spec:
  secretName: cfy-ca-tls
  commonName: NAMESPACE.svc.cluster.local
  usages:
    - server auth
    - client auth
  isCA: true
  duration: "87660h"
  issuerRef:
    name: selfsigned-issuer
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: cfy-ca-issuer
spec:
  ca:
    secretName: cfy-ca-tls
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: cfy-cert
spec:
  secretName: cfy-certs
  isCA: false
  duration: "87660h"
  usages:
    - server auth
    - client auth
  dnsNames:
    - "postgres-postgresql.NAMESPACE.svc.cluster.local"
    - "rabbitmq.NAMESPACE.svc.cluster.local"
    - "cloudify-manager-worker.NAMESPACE.svc.cluster.local"
    - "postgres-postgresql"
    - "rabbitmq"
    - "cloudify-manager-worker"
    - "localhost"
  issuerRef:
    name: cfy-ca-issuer

Create a local copy of the cert-issuer.yaml and apply it to the namespace:

$ kubectl apply -f ./cert-issuer.yaml -n NAMESPACE

Clone cloudify-helm repo

This step is necessary because the following steps will require files from this directory

  • In case you don't have Git installed - https://github.com/git-guides/install-git
$ git clone https://github.com/cloudify-cosmo/cloudify-helm.git && cd cloudify-helm

Install cloudify manager worker

Create secret/configMap with premium license - required if using Cloudify premium version

Create license.yaml file and populate it with license data

apiVersion: v1
kind: ConfigMap
metadata:
  name: cfy-license
  namespace: <NAMESPACE>
data:
  cfy_license.yaml: |
    license:
      capabilities: null
      cloudify_version: null
      customer_id: <CUSTOMER_ID>
      expiration_date: 12/31/2021
      license_edition: Premium
      trial: false
    signature: !!binary |
      <LICENSE_KEY>

Enable license in values file

  • License name (metadata.name) must match the secretName in the values file
license:
  secretName: cfy-license

Apply created config map:

$ kubectl apply -f license.yaml

Add the cloudify-helm repo

Add the cloudify-helm chart repo or upgrade it

$ helm repo add cloudify-helm https://cloudify-cosmo.github.io/cloudify-helm

or

$ helm repo update cloudify-helm

If you want to customize the values it's recommended to do so before installing the chart - see configuration options below, and either way make sure to review the values file.

Enable PostgreSQL and RabbitMQ deployment

For now deploy PostgreSQL and RabbitMQ as dependent subcharts disabled by default for backward compatibility, so for new deployment you need to enable them.

To do that please ensure you have following parameters in the values file:

postgresql:
  deploy: true

rabbitmq:
  deploy: true

(optional) If you want to use k8s secrets for store passwords

PostgreSQL initial password

Create k8s secret:

$ kubectl -n NAMESPACE create secret generic SECRET_NAME --from-literal=postgresql-password='POSTGRESQL_INIT_PASSWORD'

Update following parameters in your helm values file:

db:
  serverExistingPasswordSecret: "SECRET_NAME"

postgresql:
  existingSecret: "SECRET_NAME"

PostgreSQL application connection password

Create k8s secret:

$ kubectl -n NAMESPACE create secret generic SECRET_NAME --from-literal=postgresql-cloudify-password='POSTGRESQL_CLOUDIFY_PASSWORD'

Update following parameters in your helm values file:

db:
  cloudifyExistingPassword:
    secret: "SECRET_NAME"

RabitMQ password

Create k8s secret:

$ kubectl -n NAMESPACE create secret generic SECRET_NAME --from-literal=rabbitmq-password='RABBITMQ_PASSWORD' --from-literal=rabbitmq-erlang-cookie='RABBITMQ_ERLANG_COOKIE'

Update following parameters in your helm values file:

queue:
  existingPasswordSecret: "SECRET_NAME"

rabbitmq:
  auth:
    existingPasswordSecret: "SECRET_NAME"
    existingErlangSecret: "SECRET_NAME"

Cloudify Manager worker admin password

Create k8s secret:

$ kubectl -n NAMESPACE create secret generic SECRET_NAME --from-literal=cfy-admin-password='CLOUDIFY_ADMIN_PASSWORD'

Update following parameters in your helm values file:

config:
  security:
    existingAdminPassword:
      secret: "SECRET_NAME"

(optional) Ensure UI access to the manager upon installation

[OPTION 1]

Use ingress-controller (e.g. NGINX Ingress Controller - https://kubernetes.github.io/ingress-nginx/deploy/)

HTTP

  • Modify Ingress section accordingly (see example):
    ingress:
      enabled: true
      host: cloudify-manager.DOMAIN
      annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/proxy-body-size: 50m # use this annotation to allow upload of resources up to 50mb (e.g. plugins)
        # cert-manager.io/cluster-issuer: "letsencrypt-prod" # use this annotation to utilize an installed cert-manager
      tls:
        enabled: false
        secretName: cfy-secret-name
    
    HTTPS - Pre-applied SSL Cert
  • Create SSL secret with tls certificate
    apiVersion: v1
    kind: Secret
    metadata:
      name: cfy-secret-name
      namespace: NAMESPACE
    data:
      tls.crt: SSL_TLS_CRT
      tls.key: SSL_TLS_KEY
    type: kubernetes.io/tls
    
  • Modify Ingress section accordingly (see example):
    ingress:
      enabled: true
      host: cloudify-manager.DOMAIN
      annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/proxy-body-size: 50m # use this annotation to allow upload of resources up to 50mb (e.g. plugins)
        # cert-manager.io/cluster-issuer: "letsencrypt-prod" # use this annotation to utilize an installed cert-manager
      tls:
        enabled: true
        secretName: cfy-secret-name
    
    HTTPS - Certificate Manager
  • Use certificate manager (e.g. Let's Encrypt via cert-manager - https://cert-manager.io/docs/)
  • Modify Ingress section accordingly (see example):
    ingress:
      enabled: true
      host: cloudify-manager.DOMAIN
      annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/proxy-body-size: 50m # use this annotation to allow upload of resources up to 50mb (e.g. plugins)
        cert-manager.io/cluster-issuer: "<cluster-issuer-name>" # use this annotation to utilize an installed cert-manager
      tls:
        enabled: true
        secretName: cfy-secret-name
    **HTTP/HTTPS options will expose Cloudify Manager UI on a URL matching the `host` value**
    

[OPTION 2]

Skip Ingress and expose the Cloudify Manager service using LoadBalancer.

To have a fixed URL, you must utilize a DNS service to route the LB URL (hostname) to the URL you want.

HTTP

For this method you need to edit the Service section to use the right type:

service:
  host: cloudify-manager-worker
  type: LoadBalancer
  name: cloudify-manager-worker
  http:
    port: 80
  https:
    port: 443
  internal_rest:
    port: 53333

That will create a load balancer depending on your K8S infrastructure (e.g. EKS will create a Classic Load Balancer).

Also please add parameter config.public_ip with DNS name which you are going to configure for you Cloudify Manager load balancer endpoint, for example:

config:
  public_ip: cloudify-manager.example.com

To get the hostname of the load balancer run:

$ kubectl describe svc/cloudify-manager-worker -n NAMESPACE | grep Ingress

Then you can configure DNS record (ALIAS type), points to this load balancer hostname.

The value of the ingress will be the UI URL of the Cloudify Manager.

HTTPS

  • To secure the site with SSL you can update the load balancer configuration to utilize an SSL Certificate

After values are verified, install the manager worker chart

$ helm install cloudify-manager-worker cloudify-helm/cloudify-manager-worker --version 0.4.0 -f ./cloudify-manager-worker/values.yaml -n NAMESPACE

Configuration options of cloudify-manager-worker values.yaml

KeyTypeDefaultDescription
additionalSecretsobject{}Additional secrets to mount on the manager worker pod, make sure the 'name' is also the secret name in the cluster. uncomment secrets and define your mounts More than one secret can be added and more than one mount+sub Path can defined for each secret. (below is an example), . secrets need to be base64 encoded
authobjectobjectParameters group for auth (for CM worker version >= 7.0)
auth.afterLogoutUrlstring"/console/login"After logout page URL
auth.certPathstring""Path to SSL certificate
auth.loginPageUrlstring"/console/login"Login page URL
auth.typestring"local"Auth type
configobjectobjectParameters group for Cloudify Manager configuration
config.after_bashstring""bash commands for execute after main startup script
config.caCertPathstring"/mnt/cloudify-data/ssl/ca.crt"Path to CA certificate.
config.cliLocalProfileHostNamestring"localhost""manager.cli_local_profile_host_name" parameter from Cloudify Manager config.yaml file.
config.labelsobject{}Add labels to Manager-worker container (see example below). example-label: "cloudify-example"
config.mgmtWorkerCountint8Maximum number of worker processes started by the management worker.
config.minReadySecondsint120Minimum number of seconds for which a newly created Pod should be running and r

Deploy cloudify-manager-worker with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cloudify-manager-worker on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcloudify-manager-worker is pinned at v0.4.9 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply