• Stars
    star
    482
  • Rank 89,233 (Top 2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Making local Kubernetes clusters fun and easy to set up

ctlptl

Build Status GoDoc

Want to mess around with Kubernetes, but don't want to spend an ocean on hardware?

Maybe you need a ctlptl.

What is 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.

How do I install it?

Install your cluster of choice: Docker for Desktop, Kind, k3d or Minikube. Then run:

Homebrew (Mac/Linux)

brew install tilt-dev/tap/ctlptl

Scoop (Windows)

scoop bucket add tilt-dev https://github.com/tilt-dev/scoop-bucket
scoop install ctlptl

Go install

go install github.com/tilt-dev/ctlptl/cmd/ctlptl@latest

Alternative Options

If automatic installers aren't your cup of tea, check out the installation appendix for more options.

How do I use it?

ctlptl supports 4 major commands:

  • ctlptl get - see all running clusters
  • ctlptl create cluster [product] - create a cluster and make it the current kubectl context
  • ctlptl apply -f cluster.yaml - ensure a cluster exists, or create one
  • ctlptl delete -f cluster.yaml - delete a cluster and its state

Examples

Docker for Mac: Enable Kubernetes and set 4 CPU

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

Docker for Mac: Reset and shutdown Kubernetes

ctlptl delete cluster docker-desktop
ctlptl docker-desktop quit

KIND: with a built-in registry at a random port

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}}'

KIND: with a built-in registry at a pre-determined port

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

K3D: with a built-in registry at a pre-determined port

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

Minikube: with a built-in registry at Kubernetes v1.18.8

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

Docker for Mac: Limit to 1 CPU and Disable Kubernetes

ctlptl docker-desktop set vm.resources.cpus 1
ctlptl docker-desktop set kubernetes.enabled false

More

For more details, see:

Why did you make this?

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.

Features

Current

  • 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

Future Work

  • Microk8s
  • Rancher Desktop
  • Podman
  • Minikube on Hyperkit
  • Allocating Memory
  • Allocating Storage

Community

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.

Goals

  • 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, or microk8s

  • 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

Non-Goals

  • ctlptl is NOT a Kubernetes setup approach that competes with kind or minikube, 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 out clusterapi.

Privacy

ctlptl sends anonymized usage statistics, so we can improve it on every platform. Opt out with ctlptl analytics opt out.

License

Copyright 2022 Docker, Inc.

Licensed under the Apache License, Version 2.0

More Repositories

1

tilt

Define your dev environment as code. For microservice apps on Kubernetes.
Go
7,240
star
2

tilt-extensions

Extensions for Tilt
Starlark
186
star
3

kind-local

An example of how to set up a local image registry for Tilt+Kind
Shell
115
star
4

mish

Go
57
star
5

servantes

A microservice app that demonstrates the power of tilt
Go
49
star
6

pixeltilt

Go
44
star
7

k3d-local-registry

Easy set-up (via k3d) for k3s cluster with local registry for use with Tilt
Shell
33
star
8

tilt-avatars

Sample project for the Tilt getting started tutorial
JavaScript
31
star
9

tilt-example-go

An example project that demonstrates live Go development in Kubernetes
Go
27
star
10

starlark-lsp

Starlark LSP server
Go
25
star
11

tilt-example-nodejs

An example project that demonstrates fast updates to a NodeJS server running on Kubernetes
JavaScript
21
star
12

uselessoperator

A Useless Machine As A Kubernetes Operator
Go
21
star
13

protocc

Compile protobufs (protoc) inside a container (protocc)!
Python
19
star
14

pets

Process for Editing Tons of Services ๐Ÿˆ๐Ÿˆ๐Ÿˆ
Go
19
star
15

tilt-example-java

An example project that demonstrates live Java development in Kubernetes
Java
19
star
16

tilt.build

Tilt landing page
HTML
19
star
17

tiltfile.tmbundle

Tiltfile syntax highlighting support in JetBrains IDEs & others
18
star
18

tilt-example-python

An example project that demonstrates fast updates to a Flask server running on Kubernetes
Python
17
star
19

tilt-apiserver

Tilt apiserver based on kubernetes/apiserver
Go
14
star
20

vscode-go-autotest

TypeScript
13
star
21

bazel_example

Starlark
13
star
22

vscode-tilt

Visual Studio Code extension with Tiltfile syntax highlighting & autocomplete
TypeScript
11
star
23

tilt-example-bazel

Iterative examples of how to set up Bazel with Tilt
Starlark
11
star
24

tilt-frontend-demo

JavaScript
10
star
25

minikube-local

The best way to set minikube up for local development
Shell
9
star
26

tiltwords

Hackweek project: solve crossword puzzles in your terminal, but only if none of your builds are red!
Python
9
star
27

k8s-rbac-testing

Shell scripts for help automating rbac setup
Shell
8
star
28

buildbench

tips and tricks for building containers faster
Makefile
7
star
29

fast

The Quest For The Fastest Deployment Time
Go
7
star
30

ephemerator

An example ephemeral environment dashboard
Go
7
star
31

tilt-helm-demo

Demo of Tilt with Helm
Mustache
7
star
32

tilt-example-builders

A collection of examples of how to use Tilt with different image builders
Starlark
6
star
33

tilt-example-csharp

C#
6
star
34

localregistry-go

Go implementation of the local registry discovery protocol
Go
6
star
35

kubectl-blame-examples

https://sched.co/ekAv
Go
4
star
36

buildbench-js

Experiments with how to make Docker/JS container builds faster
Makefile
4
star
37

rerun-process-wrapper

Wrapper scripts for your container process: easily restart with restart.sh
Shell
4
star
38

tilt-inspector

A small debugging server to help inspect Tilt state
TypeScript
4
star
39

vscode-tilt-status

TypeScript
4
star
40

abc123

A simple demo app with microservices for random letters and random numbers.
Starlark
4
star
41

wat

Win At Testing
Go
3
star
42

company

How we work at Tilt
3
star
43

tilt.specs

specs for tilt!
3
star
44

debugger-examples

Example projects for running debuggers via Tilt
C#
3
star
45

api.tilt.dev

Reference docs for the Tilt API
Starlark
3
star
46

tilt-vuejs-demo

Demo Vue.js app with Tilt
Vue
3
star
47

tilt-helmfile-demo

A demo using Tilt with helmfile
Python
3
star
48

local_resource_example

Go
3
star
49

tilt-starlark-codegen

Generates starlark functions based on Kubernetes-style API models
Go
3
star
50

tilt-status-prompt

Shell
2
star
51

tilt-example-html

An example project that demonstrates a live-updating server with nothing but Shell, HTML, and Kubernetes
Shell
2
star
52

vscode-kubernetes-tools-tilt

TypeScript
2
star
53

memcached-operator

Go
2
star
54

cloud.tilt.dev

A stub for cloud.tilt.dev
HTML
2
star
55

tilt-example-frameworks

A collection of examples of how to use Tilt with different frameworks
Starlark
2
star
56

tilt-example-base-image

An example NodeJS app k8s
Python
2
star
57

go-get

A repository fetcher, forked from golang/go
Go
2
star
58

scoop-bucket

Tilt releases for the Scoop package manager
1
star
59

tilt-trigger-on-build-state

an extension to run a command whenever a tilt resource's build state changes
Shell
1
star
60

kubutton

Rust
1
star
61

live_update

Examples for using Tilt's Live Update functionality
Dockerfile
1
star
62

tilt-local-metrics

Development of the Tilt local metrics stack
Starlark
1
star
63

tilt-starlark-docs-codegen

Generates starlark function docs based on Kubernetes API models
Go
1
star
64

tiltdemo

Python
1
star
65

probe

Readiness/liveness checks inspired by K8s probes
Go
1
star
66

tilt-example-rails

An example project that demonstrates fast updates to a Rails app running on Kubernetes
Ruby
1
star
67

tilt-on-top

A little demo project on how to connect to Tilt from the OS menubar
JavaScript
1
star
68

homebrew-tap

Homebrew formulas for Tilt and other Windmill Engineering projects
Ruby
1
star
69

tilted-rails

Sandbox for generating and deploying a Rails app
Starlark
1
star
70

random_number

Simple backend+frontend random number server for demonstrating Live Update
Python
1
star