Want to mess around with Kubernetes, but don't want to spend an ocean on hardware?
Maybe you need a ctlptl
.
ctlptl
(pronounced "cattle patrol") is a CLI for declaratively setting up
local Kubernetes clusters.
Inspired by kubectl
and
ClusterAPI's clusterctl
, you
declare your local cluster with YAML and use ctlptl
to set it up.
Install your cluster of choice: Docker for Desktop, Kind, k3d or Minikube. Then run:
brew install tilt-dev/tap/ctlptl
scoop bucket add tilt-dev https://github.com/tilt-dev/scoop-bucket
scoop install ctlptl
go install github.com/tilt-dev/ctlptl/cmd/ctlptl@latest
If automatic installers aren't your cup of tea, check out the installation appendix for more options.
ctlptl
supports 4 major commands:
ctlptl get
- see all running clustersctlptl create cluster [product]
- create a cluster and make it the currentkubectl
contextctlptl apply -f cluster.yaml
- ensure a cluster exists, or create onectlptl delete -f cluster.yaml
- delete a cluster and its state
Create:
ctlptl docker-desktop open
ctlptl create cluster docker-desktop --min-cpus=4
or ensure exists:
cat <<EOF | ctlptl apply -f -
apiVersion: ctlptl.dev/v1alpha1
kind: Cluster
product: docker-desktop
minCPUs: 4
EOF
ctlptl delete cluster docker-desktop
ctlptl docker-desktop quit
Create:
ctlptl create cluster kind --registry=ctlptl-registry
or ensure exists:
cat <<EOF | ctlptl apply -f -
apiVersion: ctlptl.dev/v1alpha1
kind: Cluster
product: kind
registry: ctlptl-registry
EOF
Then fetch the URL to push images to with:
ctlptl get cluster kind-kind -o template --template '{{.status.localRegistryHosting.host}}'
Create:
ctlptl create registry ctlptl-registry --port=5005
ctlptl create cluster kind --registry=ctlptl-registry
or ensure exists:
cat <<EOF | ctlptl apply -f -
apiVersion: ctlptl.dev/v1alpha1
kind: Registry
name: ctlptl-registry
port: 5005
---
apiVersion: ctlptl.dev/v1alpha1
kind: Cluster
product: kind
registry: ctlptl-registry
EOF
Create:
ctlptl create registry ctlptl-registry --port=5005
ctlptl create cluster k3d --registry=ctlptl-registry
or ensure exists:
cat <<EOF | ctlptl apply -f -
apiVersion: ctlptl.dev/v1alpha1
kind: Registry
name: ctlptl-registry
port: 5005
---
apiVersion: ctlptl.dev/v1alpha1
kind: Cluster
product: k3d
registry: ctlptl-registry
EOF
Create:
ctlptl create cluster minikube --registry=ctlptl-registry --kubernetes-version=v1.18.8
or ensure exists:
cat <<EOF | ctlptl apply -f -
apiVersion: ctlptl.dev/v1alpha1
kind: Cluster
product: minikube
registry: ctlptl-registry
kubernetesVersion: v1.18.8
EOF
ctlptl docker-desktop set vm.resources.cpus 1
ctlptl docker-desktop set kubernetes.enabled false
For more details, see:
- Example configurations under ./examples
- Complete CLI docs under ./docs
- Cluster API reference under pkg.go.dev
At Tilt, we want to make Kubernetes a nice environment for local dev.
We found ourselves spending too much time helping teams debug misconfigurations in their dev environment.
We wrote docs like Choosing a local dev cluster and example repos like kind-local, minikube-local, and k3d-local to help people get set up.
ctlptl
is a culmination of what we've learned.
- Docker for Mac
- Docker for Windows
- KIND and KIND with a registry
- Minikube and Minikube with a registry
- K3D with a registry
- Creating a cluster on a Remote Docker Host (useful in CI environments like CircleCI)
- Allocating CPUs
- Microk8s
- Rancher Desktop
- Podman
- Minikube on Hyperkit
- Allocating Memory
- Allocating Storage
ctlptl
is a work in progress!
We welcome contributions from the Kubernetes community to help make this better.
We expect everyone -- users, contributors, followers, and employees alike -- to abide by our Code of Conduct.
-
To support common local cluster setup operations, like create, delete, and reset
-
To interoperate well with all local Kubernetes solutions, including
docker-desktop
,kind
,minikube
,k3d
, ormicrok8s
-
To connect other resources to a local cluster, like image registries, storage, and CPU/memory
-
To help infra engineers manage a consistent dev environment
-
To encourage standards that enable interop between devtools, like KEP 1755
-
ctlptl
is NOT a Kubernetes setup approach that competes withkind
orminikube
, but rather complements these tools. -
ctlptl
is NOT intended to help you setup a remote cluster, or a remote dev sandbox. If you want to declaratively set up prod clusters, check outclusterapi
.
ctlptl
sends anonymized usage statistics, so we can improve it on every platform. Opt out with ctlptl analytics opt out
.
Copyright 2022 Docker, Inc.
Licensed under the Apache License, Version 2.0