Go to file
Andy Zhou f70a8b42f7 Add support for the --publish option for create subcommand
Inspired by the docker CLI, --publish take same input as docker CLI and
provides similar functions. For the k3s cluster server node, it behaves
the same as docker cli; it exports the k3d server ports to the host
ports.

Handling for worker nodes will be added in the subsequent patches.

This option can be used mutiple times for exposing more ports.

--add-port is an alias to this option.
2019-05-08 01:45:16 -07:00
cli Add support for the --publish option for create subcommand 2019-05-08 01:45:16 -07:00
vendor connect workers and server via own docker network 2019-04-18 16:08:15 +02:00
version update default K3sVersion to use latest tag 2019-05-03 22:04:39 -04:00
.gitignore exclude binary folders 2019-04-03 09:59:23 +02:00
.travis.yml rename and add authors 2019-04-12 07:36:59 +02:00
go.mod use docker sdk wherever possible 2019-04-15 15:48:43 +02:00
go.sum enhanced list 2019-04-04 09:19:26 +02:00
install.sh rename and add authors 2019-04-12 07:36:59 +02:00
LICENSE update README 2019-04-03 10:27:09 +02:00
main.go Add support for the --publish option for create subcommand 2019-05-08 01:45:16 -07:00
Makefile Makefile: Add the install-tools target 2019-05-01 16:59:49 -07:00
README.md Makefile: Add the install-tools target 2019-05-01 16:59:49 -07:00

k3d

Build Status Go Report Card

k3s in docker

k3s is the lightweight Kubernetes distribution by Rancher: rancher/k3s

This repository is based on @zeerorg's zeerorg/k3s-in-docker, reimplemented in Go by @iwilltry42 in iwilltry42/k3d, which is now rancher/k3d.

Requirements

Install

You have several options there:

  • use the install script to grab the latest release:
    • wget: wget -q -O - https://raw.githubusercontent.com/rancher/k3d/master/install.sh | bash
    • curl: curl -s https://raw.githubusercontent.com/rancher/k3d/master/install.sh | bash
  • Grab a release from the release tab and install it yourself.
  • Via go: go install github.com/rancher/k3d

or...

Build

  1. Clone this repo, e.g. via go get -u github.com/rancher/k3d
  2. Inside the repo run
    • 'make install-tools' to make sure required go packages are installed
  3. Inside the repo run
    • make build to build for your current system
    • go install to install it to your GOPATH
    • make build-cross to build for all systems

Usage

Check out what you can do via k3d help

Example Workflow: Create a new cluster and use it with kubectl

  1. k3d create to create a new single-node cluster (docker container)
  2. export KUBECONFIG=$(k3d get-kubeconfig) to make kubectl to use the kubeconfig for that cluster
  3. execute some commands like kubectl get pods --all-namespaces
  4. k3d delete to delete the default cluster