MicroticaMicrotica

Deploy Application

Re-deploy an application to a Kubernetes cluster with the deploy step. Set the cluster, service, and image tag, and optionally filter the deploy by branch.

Deploy an application to Kubernetes.

To use this step, the application must already be deployed in the Kubernetes cluster. This step re-deploys your existing service.

Syntax

microtica.yaml
steps:
  step-name:
    type: deploy
    target: kubernetes
    cluster: my-kubernetes-cluster
    service: my-app
    tag: v0.1.0
ParameterDescriptionRequired
titleThe display name of the step.No
typeThe type of the Microtica built-in step.
Should always be deploy for this type of step.
Yes
targetShould always be kubernetes for this type of step.Yes
clusterThe name of the existing Kubernetes cluster.Yes
namespaceDeploy the application in a specific namespace.
Default: microtica
No
serviceThe name of the existing application to be deployed.Yes
tagDocker image tag to be applied with the deployment.
Default: latest
No
branch_filterIf specified, deployment will be executed only if the pipeline was triggered by push on the matched branch.
Otherwise, deployment will be triggered on every pipeline execution.
No

Re-deploy an existing application

This example assumes an application named my-app is already deployed in the Kubernetes cluster named my-cluster. To learn how to create and deploy applications, see Applications.

The pipeline below deploys an application on Kubernetes with an image tag that was previously built and pushed to a remote Docker registry.

microtica.yaml
steps:
  Clone:
    type: git-clone

  PushDockerImage:
    type: docker-push
    image_name: "microtica/my-app"
    tag: "{{MIC_PIPELINE_EXECUTION_ID}}"

  Deploy:
    type: deploy
    target: kubernetes
    cluster: my-cluster
    service: my-app
    tag: "{{MIC_PIPELINE_EXECUTION_ID}}"

To deploy the image that was just built, you use MIC_PIPELINE_EXECUTION_ID as the reference value when pushing the image to the remote registry, and the same value when deploying the application.

Trigger a deploy for a specific branch

To trigger a deploy only when the pipeline was triggered by a push on a specific branch, use the branch_filter parameter.

If you set develop as the value, the deployment is triggered only when a push is made on the develop branch.

If branch_filter is not specified, the deploy is triggered on every pipeline execution.

microtica.yaml
steps:
  Clone:
    type: git-clone

  PushDockerImage:
    type: docker-push
    image_name: "microtica/my-app"
    tag: "{{MIC_PIPELINE_EXECUTION_ID}}"

  Deploy:
    type: deploy
    target: kubernetes
    cluster: my-cluster
    service: my-app
    tag: "{{MIC_PIPELINE_EXECUTION_ID}}"
    branch_filter: develop

Next steps

On this page