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: String
  • Default value: null

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_helm_chart

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

Example:

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

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: odooPassword=password,postgresql.postgresPassword=secretpassword
    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:
  apache:
    kubernetes_helm_chart: bitnami/apache
    deployment_type: kubernetes
    kubernetes_service: apache
    kubernetes_helm_repository: bitnami https://charts.bitnami.com/bitnami

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.
  • 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_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