Skip to main content
Deploy a containerized application to the current Kubernetes cluster. Creates both a Deployment and a LoadBalancer Service.

Usage

clanker k8s deploy [image] [flags]

Arguments

image
string
required
Container image to deploy (e.g., nginx, myregistry/myapp:v1.0)

Flags

--name
string
Deployment name (default: extracted from image name)
--port
integer
default:"80"
Container port to expose
--replicas
integer
default:"1"
Number of replicas
--namespace
string
default:"default"
Kubernetes namespace
--plan
boolean
Show plan without applying changes
--apply
boolean
Apply the plan without confirmation prompt

Examples

Deploy nginx

clanker k8s deploy nginx --name my-nginx --port 80
=== Deploy Plan ===

Name:      my-nginx
Image:     nginx
Port:      80
Replicas:  1
Namespace: default
Type:      deployment

Do you want to deploy this application? [y/N]: y

[k8s] deploying application...
deployment.apps/my-nginx created
service/my-nginx created

=== Deployment Successful ===

Commands:
  kubectl get pods -n default
  kubectl get svc my-nginx -n default
  kubectl logs -f deployment/my-nginx -n default

Deploy with multiple replicas

clanker k8s deploy myapp:v1.0 --replicas 3 --port 8080

Show deployment plan

clanker k8s deploy nginx --plan
=== Deploy Plan ===

Name:      nginx
Image:     nginx
Port:      80
Replicas:  1
Namespace: default
Type:      deployment

Plan JSON:
{
  "type": "deploy",
  "title": "Deploy Application",
  "description": "Deploy nginx to Kubernetes",
  "resources": [
    {
      "type": "deployment",
      "name": "nginx",
      "image": "nginx",
      "port": 80,
      "replicas": 1
    },
    {
      "type": "service",
      "name": "nginx",
      "port": 80,
      "serviceType": "LoadBalancer"
    }
  ]
}

Deploy to specific namespace

clanker k8s deploy redis --namespace cache --port 6379

Generated resources

The deploy command creates the following Kubernetes resources:
  1. Deployment: Manages the specified number of pod replicas running your container image
  2. Service: Exposes your deployment via a LoadBalancer with the specified port
Both resources are created in the specified namespace and use matching labels for pod selection.
The deployment creates a LoadBalancer service by default. On cloud providers like AWS and GCP, this will provision an external load balancer. For local or on-premises clusters, you may need to configure an ingress controller or use a different service type.

Build docs developers (and LLMs) love