Kubernetes

The CloudShark Docker container can be deployed using the Kubernetes container orchestration system.

This article outlines the additional requirements and provides an example Kubernetes Deployment Workload that can be used as a starting point.

All of the files necessary to build the CloudShark Docker image are distributed from the QA Cafe Customer Lounge.


Sample Deployment

Here is an sample Kubernetes Deployment that runs the CloudShark Docker container in a Pod:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: cloudshark-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cloudshark
  strategy:
    type: Recreate
  template:
	metadata:
  	labels:
    	  app: cloudshark
  spec:
    containers:
      - name: app
        image: cloudshark:4.0.0
        ports:
          - containerPort: 443
        env:
          - name: DATABASE_URL
            value: "mysql://<user>@<host>/<dbname>"
          - name: REDIS_URL
            value: "redis://<host>/"
          - name: MEMCACHE
            value: "<host>:<port>"
          - name: QACAFE_LICENSE_SERVER
            value: "<host>"
        volumeMounts:
          - name: cloudshark-data
            mountPath: /usr/cloudshark/data
          - name: cloudshark-etc
            mountPath: /usr/cloudshark/etc
    securityContext:
      runAsUser: 0
      runAsGroup: 0
      runAsNonRoot: false
    volumes:
      - name: cloudshark-data
        persistentVolumeClaim:
          claimName: cloudshark-data-pvc
      - name: cloudshark-etc
        persistentVolumeClaim:
          claimName: cloudshark-etc-pvc

More information on the environment variables and volumes required to run CloudShark in a container can be found in our guide for installing CloudShark via Docker.

Volumes

Unlike Docker, containers run in Kubernetes do not pre-populate volume mounts with content from a container automatically. The initial contents of the volume mounted at /usr/cloudshark/etc must be populated. Contact support@qacafe.com for assistance and the files required in this directory to run the CloudShark container.

The volume mounted at /usr/cloudshark/data does not need to be populated with any contents initially.

Deployment Strategy

Updates to CloudShark may alter the database schema and running two different versions pointing to the same database is not supported. Thus, the required Strategy of the Kubernetes Deployment is Recreate rather than the default value RollingUpdate.