Kubernetes Specific YAML fields

Back to the Squash YAML file page.

Supported YAML fields

The YAML fields below are supported on Kubernetes based deployments only.

deployment_type

  • This controls the deployment type: Docker or Kubernetes
  • Mandatory field: Yes for Kubernetes. You need to set this value as “kubernetes”
  • Data Type: Choices: kubernetes, docker
  • Default value: docker

For this example we are using a regular Docker image to deploy the k8s environment. You may also pull the image from an external registry and define credentials using environment variables.

deployments:
  dockertest:
    dockerimage: example.io/acme-corp/apis/dockertest:master
    deployment_type: kubernetes
    docker_registry:
      server: example.io
      username: acme
      password: $REGISTRY_PASSWORD

kubernetes_build_image

  • Defines the default Kubernetes or Docker image to be used. Equivalent of an image used within the kubectl run --image={image} command.
  • Mandatory field: No.
  • Data Type: String
  • Default value: null

Example:

deployments:
  MyAppName:
    kubernetes_build_image: nginx
    deployment_type: kubernetes
    use_kubernetes_registry: true

kubernetes_default_pod

  • Defines the default Kubernetes pod to be used for port forwarding once a pod reaches the Running status. If this is not defined, the first listed pod will be used instead.
  • Mandatory field: No
  • Data Type: String
  • Default value: null

Example:

deployments:
  MyAppName:
    kubernetes_manifest: ./pod.yml
    deployment_type: kubernetes
    kubernetes_default_image: rss-site

kubernetes_forwarding_wait

  • This is a specific waiting time (in seconds) before Squash can start checking for a success response after the Kubernetes pods are running. This is useful if your application/containers need some additional time before they are ready to start receiving requests.
  • Mandatory field: No
  • Data Type: Integer
  • Default value: 0

Example:

deployments:
  odoo:
    kubernetes_helm_chart: stable/odoo
    deployment_type: kubernetes
    kubernetes_service: odoo
    kubernetes_forwarding_wait: 1200

kubernetes_helm_chart

  • Defines one or more helm charts to be installed during the deployment.
  • Mandatory field: No
  • Data Type: String
  • Default value: null

Example using one helm chart:

deployments:
  drupal:
    kubernetes_helm_chart: stable/drupal
    deployment_type: kubernetes
    kubernetes_service: drupal

Example with multiple helm charts:

deployments:
  drupal:
    kubernetes_helm_chart: 
      - stable/drupal
      - bitnami/apache
      - kiwigrid/graphite
    deployment_type: kubernetes
    kubernetes_service: drupal
    kubernetes_default_pod: drupal
    kubernetes_helm_repository: 
      - bitnami https://charts.bitnami.com/bitnami
      - kiwigrid https://kiwigrid.github.io
    kubernetes_port_mapping:
      - svc/apache:3000:80
      - svc/graphite:8080
    subdomain_port_mapping: 
      - apache:3000
      - graphite:8080

kubernetes_helm_parameters

  • Defines additional parameters to be set during the Helm chart installation. Supports multiple parameters separated by comma or in list format.
  • Mandatory field: No
  • Data Type: String or list of strings
  • Default value: null

Example:

deployments:
  odoo:
    kubernetes_helm_chart: stable/odoo
    kubernetes_helm_parameters: odooPwd=pwd,psql.pwd=secred
    deployment_type: kubernetes
    kubernetes_service: odoo

kubernetes_helm_repository

  • Defines the Kubernetes helm repository to be added if the Helm chart is not from the default repository. By default the stable repository will be used.
  • Mandatory field: No
  • Data Type: String
  • Default value: null

Example:

deployments:
  MyApp:
    kubernetes_helm_chart: bitnami/apache
    deployment_type: kubernetes
    kubernetes_service: apache
    kubernetes_helm_repository: bitnami https://charts.io/chart

kubernetes_kustomization

  • Can be used when a kustomization.yaml file should be applied during the Kubernetes deployment. Defines a kustomization directory that should be processed. This field won’t be used  when the kubernetes_manifest is defined.
  • Mandatory field: No
  • Data Type: String
  • Default value: null

Example:

deployments:
  mysql-wordpress-pd:
    kubernetes_kustomization: mysql-wordpress-pd/
    deployment_type: kubernetes
    kubernetes_service: wordpress
    kubernetes_default_image: wordpress

kubernetes_manifest

  • Defines Kubernetes manifests to be applied during the deployment. Supports multiple manifests separated by comma or in list format.
  • Mandatory field: No
  • Data Type: String
  • Default value: null

Example:

deployments:
  MyAppName:
    kubernetes_manifest: pod.yml, ./pod2.yml
    deployment_type: kubernetes
    kubernetes_service: rss-site

kubernetes_namespace

  • Defines a Kubernetes namespace to be used during the deployment.
  • Mandatory field: No
  • Data Type: String
  • Default value: null

Example:

deployments:
  MyAppName:
    kubernetes_manifest: odoo.yml
    deployment_type: kubernetes
    kubernetes_service: odoo-shop
    kubernetes_namespace: odoo

kubernetes_port_mapping

  • Defines additional port mappings for running pods, useful when the subdomain_port_mapping option is defined
  • Mandatory field: No
  • Data Type: List
  • Format for this field: <pod_name>:<port>
  • Default value: null

Example:

deployments:
  MyAppName:
    kubernetes_manifest: pod.yml, pod2.yml
    deployment_type: kubernetes
    kubernetes_default_image: rss-site
    kubernetes_port_mapping: redmine:3000
    subdomain_port_mapping: redmine:3000

kubernetes_secrets

  • Defines a list of secrets to be used within Kubernetes containers . You may also use Squash Environment Variables in this field.
  • Mandatory field: No
  • Data Type: List of strings
  • Default value: null

Example using one line for the secrets:

deployments:
  MyApp:
    kubernetes_manifest: pod.yml, pod2.yml
    deployment_type: kubernetes
    kubernetes_default_pod: rss-site
    kubernetes_secrets: generic db-user-pass --from-file=./username.txt --from-file=./password.txt

Example using multiple lines:

deployments:
  MyApp:
    kubernetes_manifest: pod.yml, pod2.yml
    deployment_type: kubernetes
    kubernetes_default_pod: rss-site
    kubernetes_port_mapping: redmine:3000
    subdomain_port_mapping: redmine:3000
    docker_registry:
      server: r.example.io
      username: myapp_user
      password: $REGISTRY_PASSWORD
    kubernetes_secrets:
      - generic ssh-key-secret --from-file=ssh-privatekey=/home/test-instance/.ssh/id_rsa --from-file=ssh-publickey=/home/test-instance/.ssh/id_rsa.pub
      - generic db-user-pass --from-file=./username.txt --from-file=./password.txt

kubernetes_service

  • Defines the default Kubernetes service to be used for port forwarding once at least one pod reaches the Running status. If this is not defined, the first listed pod is used instead.
  • Mandatory field: No
  • Data Type: String
  • Default value: null

Example:

deployments:
  MyAppName:
    kubernetes_manifest: ./pod.yml
    deployment_type: kubernetes
    kubernetes_service: rss-site

use_kubernetes_registry

  • Used together with the kubernetes_build_image or dockerimage options. When disabled and no docker_registry option is defined, Squash will attempt to use a local image instead.
  • Mandatory field: No
  • Data Type: String
  • Default value: null

Example:

deployments:
  MyAppName:
    kubernetes_build_image: nginx
    deployment_type: kubernetes
    use_kubernetes_registry: true

using a regular docker image:

deployments:
  MyAppName:
    dockerimage: ghost
    deployment_type: kubernetes
    use_kubernetes_registry: false
    port_forwarding: 80:2368