Tools for Deploying Docker to Kubernetes, Swarm, ECS and more…

Tools for Deploying Docker to Kubernetes, Swarm, ECS and more…

2 min read

One of the unique aspects of Codefresh’s pipelines is that each step runs in it’s own container. This means adding a custom step is as easy as calling in a Docker image. We’ve created a number of images to make it easy to deploy.

Kubernetes Deploy Tools

If you’re using Codefresh, the Kubernetes deployment step can be configured through the UI and will generate a YAML pipeline step that looks similar to this:

  RunningDeployScript:
    title: Running Deploy Script
    type: deploy
    kind: kubernetes
    cluster: cluster-1@FirstKubernetes
    namespace: demochat
    when:
      branch:
        only:
          - master
    service: demochat-prod

We’ve done this to simply interactions with deployment. If you want to work directly with the image, either on your own local machine, or in another tool you can snag the image from Docker hub.

Swarm Deploy Tools

Docker Swarm is defined using the docker-compose  format and is beloved for it’s ease of use, especially for local development. Codefresh provides a helper image for deploying to Swarm as well as a built-in environment for testing applications.

The YAML step for calling the Swarm deploy image looks like this

deploy_to_swarm:
    image: codefresh/remote-docker
    working_directory: ${{main_clone}}
    commands:
      - rdocker ${{RDOCKER_HOST}} docker stack deploy --compose-file docker-stack.yml ${{STACK_NAME}}
    environment:
      - SSH_KEY=${{SSH_KEY}}
    when:
      branch:
        only:
          - master

Where the ${{}} refer to variables defined for a pipeline.

You can read more about using this image in our documentation.

ECS Deploy Tools

Amazon Elastic Container Service is one of the most popular ways containers are deployed into production today. If you’re using Codefresh to deploy your containers, you can select the ECS deploy image in the UI. It will add a step that looks like this to your YAML

deploy to ecs:
    image: codefresh/cf-deploy-ecs    # the name of the Codefresh docker image (not your image)
    commands:
      - cfecs-update --image-name <image-fullname-without-tag> --image-tag '${{CF_BRANCH}}' <aws-region> <ecs-cluster-name> <ecs-service-name>
  *     environment:
      - AWS_ACCESS_KEY_ID=${{AWS_ACCESS_KEY_ID}}
      - AWS_SECRET_ACCESS_KEY=${{AWS_SECRET_ACCESS_KEY}}

    when:
      branch:
        only:
          - master

To use this image yourself, or learn more about how it works, check out our documentation.

Helm Deploy Tools

Helm is a Kubernetes package manager. It’s much more powerful that something like Docker-compose. This image offers a few advantages over just running helm install <chart name>. In addition to automatically installing Tiller it also has some tooling for parsing json which really valuable if you want to parse secrets and copy them to other namespaces.

Here’s the documentation.

New to Codefresh? Get started with Codefresh by signing up for an account today!

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Build your GitOps skills and credibility today with a GitOps Certification.

Get GitOps Certified

Ready to Get Started?
  • safer deployments
  • More frequent deployments
  • resilient deployments