Solutions / Docker & Kubernetes

Docker & Kubernetes CI/CD: build images and deploy to any cluster

Kubernetes CI/CD builds and tests your container images on every push, then deploys them to your clusters automatically. Semaphore runs CI/CD in any Docker image, builds images fast with the full Docker CLI, and deploys to Kubernetes on any cloud.

Build in

Any Docker image

Registries

Public or private, all common ones

Deploy to

Kubernetes, ECS, Swarm, any host

Clouds

AWS, Google Cloud, Azure, DO

TL;DR

  • Semaphore’s Kubernetes CI/CD builds Docker images, tests them and deploys to your clusters from one pipeline.
  • Run jobs in any public or private Docker image, or use the ready-made images in the Semaphore Container Registry.
  • Build images up to 7× faster with bare-metal performance and the full Docker CLI in clean Linux VMs.
  • Deploy with promotions and deployment targets: canary releases from main, on-demand staging, and rollbacks to any known-good version.

How Kubernetes CI/CD works on Semaphore

01

Build the image

Every push builds and tags a Docker image in a clean Linux VM.

02

Test and push

Tests run against the image, then it’s pushed to your registry.

03

Deploy to the cluster

A promotion rolls the new image out to Kubernetes, with approvals if you need them.

Example Docker & Kubernetes CI/CD pipeline

Build and push an image tagged with the commit, then promote passing builds on main to your Kubernetes cluster.

.semaphore/semaphore.yml

version: v1.0
name: Build and push
agent:
  machine:
    type: f1-standard-2
    os_image: ubuntu2404
blocks:
  - name: Docker build
    task:
      secrets:
        - name: dockerhub
      jobs:
        - name: Build and push
          commands:
            - checkout
            - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
            - docker build -t myorg/app:$SEMAPHORE_GIT_SHA .
            - docker push myorg/app:$SEMAPHORE_GIT_SHA
promotions:
  - name: Deploy to Kubernetes
    pipeline_file: deploy-k8s.yml
    auto_promote:
      when: "branch = 'main' AND result = 'passed'"

.semaphore/deploy-k8s.yml (job commands)

kubectl set image deployment/app app=myorg/app:$SEMAPHORE_GIT_SHA
kubectl rollout status deployment/app

Keep your registry login and kubeconfig as encrypted secrets, and protect production with deployment targets.

What’s included in Semaphore Docker & Kubernetes CI/CD

Up to 7× faster Docker builds

Build images faster than on typical CI runners, with bare-metal performance.

Complete flexibility

Build with the full Docker CLI in clean Linux VMs, then deploy or promote to any registry. Docker docs

Auto-scaling

Machines scale with every git push, and you only pay for what you use. Cloud CI/CD

Any Docker image, any registry

Run jobs in public or private images and use the pre-built Semaphore Container Registry. Container registry

Enterprise-grade releases

Canary releases from main, on-demand staging from dev, and any known-good version shipped again. Promotions

Works with any cloud

Deploy to AWS, Google Cloud, Azure, DigitalOcean, your own Kubernetes, ECS, Docker Swarm or any Docker host.

Secure, monitored deployments

Secrets, security scanners, Slack alerts and custom dashboards for every deployment. Deployment targets

Microservices and monorepos

Build and deploy only the services that changed. Monorepos

Customer stories

Faster builds and releases with parallel testing and real-time debugging; higher reliability through visual workflows and flaky test analysis.

Derek Rockwell, CTO and CISO at Fabric · Case study

Packaging build times reduced by 70%, release pipelines accelerated by 75%, and 50% lower resource usage after migrating from Jenkins.

Sneha Wadhwa, Senior Software Engineer II at Confluent · Case study

Build times cut by 80–83%, and 20% cost savings with custom build triggers.

Jenah Blitz, Software Engineer at Simply Business · Case study

More case studies

CI/CD for other platforms

FAQs

What is Kubernetes CI/CD?

Kubernetes CI/CD is a pipeline that builds and tests your application as container images on every change, pushes them to a registry, and deploys them to Kubernetes clusters automatically. Semaphore handles the whole flow, from docker build to kubectl rollout.

Can I run CI jobs inside my own Docker image?

Yes. Jobs can run in any public or private Docker image, or in ready-made images from the Semaphore Container Registry. See Docker environments.

Which registries and clouds does Semaphore work with?

All common container registries, public or private, and any cloud: AWS, Google Cloud, Azure, DigitalOcean, your own Kubernetes, ECS, Docker Swarm or any Docker host.

How do I deploy to Kubernetes from Semaphore?

Store your kubeconfig or cloud credentials as encrypted secrets, then add a promotion that runs kubectl or Helm to roll out the new image. Use deployment targets to control who can deploy to each environment.

Can I run Semaphore itself on Kubernetes?

Yes. The open-source Community Edition and Enterprise can be installed on your own Kubernetes cluster, and self-hosted agents can autoscale on Kubernetes.

Next steps

Start Kubernetes CI/CD free · Docker docs · Docker and Kubernetes ebook · Pricing

From the blog

Star us on GitHub