Contribute to Kubectl

Attend a sig-cli meeting

The best way to get started is to attend sig-cli meetings. The bug scrub is a great place to pick up an issue to work on.

Checking out the code

Install golang

Install the latest version of go

Get a copy of the code

Fork and clone the kubernetes repository

git clone git@github.com/USER/kubernetes
cd kubernetes

Build the binary

Build the binary using go build

cd cmd/kubectl
go build -v
./kubectl version

Edit the code

The kubectl code is under staging/src/k8s.io/kubectl.

  • Libraries are under staging/src/k8s.io/kubectl/pkg
  • Command implementations are under staging/src/k8s.io/kubectl/pkg/cmd

Learning about libraries

Kubectl uses a number of common libraries

  • cobra – a golang framework for CLIs
  • client-go – libraries for talking to the Kubernetes apiserver
  • api – Kubernetes types
  • apimachinery – Kubernetes apimachinery libraries

Additional resources

Last modified November 11, 2020: Add kubectl contributing guide (eabe0f6)