Kubernetes is an open source implementation of container cluster management.
Kubernetes can run anywhere!
However, initial development was done on GCE and so our instructions and scripts are built around that. If you make it work on other infrastructure please let us know and contribute instructions/code.
Kubernetes is in pre-production beta!
While the concepts and architecture in Kubernetes represent years of experience designing and building large scale cluster manager at Google, the Kubernetes project is still under heavy development. Expect bugs, design and API changes as we bring it to a stable, production product over the coming year.
- Getting Started Guides
- kubecfg command line tool
- Kubernetes API Documentation
- Discussion and Community Support
- Hacking on Kubernetes
- Hacking on Kubernetes Salt configuration
Where to go next?
Or fork and start hacking!
Community, discussion and support
If you have questions or want to start contributing please reach out. We don't bite!
If you are a company and are looking for a more formal engagement with Google around Kubernetes and containers at Google as a whole, please fill out this form. and we'll be in touch.
Go development environment
Put kubernetes into GOPATH
We highly recommend to put kubernetes' code into your GOPATH. For example, the following commands will download kubernetes' code under the current user's GOPATH (Assuming there's only one directory in GOPATH.):
$ echo $GOPATH /home/user/goproj $ mkdir -p $GOPATH/src/github.com/GoogleCloudPlatform/ $ cd $GOPATH/src/github.com/GoogleCloudPlatform/ $ git clone firstname.lastname@example.org:GoogleCloudPlatform/kubernetes.git
The commands above will not work if there are more than one directory in
godep and dependency management
Kubernetes uses godep to manage dependencies. Please make sure that
godep is installed and in your
$PATH. If you have already set up Go development environment correctly, the following command will install
godep into your
$GOBIN directory, which is
$GOPATH/bin by default if
$GOBIN is not set:
go get github.com/tools/godep
Here is a quick summary of
godep helps manage third party dependencies by copying known versions into Godep/_workspace. You can use
godep in three ways:
godepto call your
gocommands. For example:
godep go test ./...
godepto modify your
$GOPATHso that other tools know where to find the dependencies. Specifically:
export GOPATH=$GOPATH:$(godep path)
godepto copy the saved versions of packages into your
$GOPATH. This is done with
We recommend using options #1 or #2.
Before committing any changes, please link/copy these hooks into your .git directory. This will keep you from accidentally committing non-gofmt'd go code.
../.. part seems odd but is correct, since the newly created
links will be 2 levels down the tree.
cd kubernetes ln -s ../../hooks/prepare-commit-msg .git/hooks/prepare-commit-msg ln -s ../../hooks/commit-msg .git/hooks/commit-msg
cd kubernetes hack/test-go.sh
Alternatively, you could also run:
cd kubernetes godep go test ./...
If you only want to run unit tests in one package, you could run
godep go test under the package directory. For example, the following commands will run all unit tests in package kubelet:
$ cd kubernetes # step into kubernetes' directory. $ cd pkg/kubelet $ godep go test # some output from unit tests PASS ok github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet 0.317s
cd kubernetes godep go tool cover -html=target/c.out
You need an etcd somewhere in your path. To get from head:
go get github.com/coreos/etcd go install github.com/coreos/etcd sudo ln -s "$GOPATH/bin/etcd" /usr/bin/etcd # Or just use the packaged one: sudo ln -s "$REPO_ROOT/target/bin/etcd" /usr/bin/etcd
cd kubernetes hack/test-integration.sh
With a GCE account set up for running
cluster/kube-up.sh (see Setup above):
cd kubernetes hack/e2e-test.sh
To add a new package
- Download foo/bar into the first directory in GOPATH:
go get foo/bar.
- Change code in kubernetes to use
godep save ./...under kubernetes' root directory.
To update a package
- Update the package with
go get -u foo/bar.
- Change code in kubernetes accordingly if necessary.
godep update foo/bar.
Keeping your development fork in sync
One time after cloning your forked repo:
git remote add upstream https://github.com/GoogleCloudPlatform/kubernetes.git
Then each time you want to sync to upstream:
git fetch upstream git rebase upstream/master
Regenerating the API documentation
cd kubernetes/api sudo docker build -t kubernetes/raml2html . sudo docker run --name="docgen" kubernetes/raml2html sudo docker cp docgen:/data/kubernetes.html .
View the API documentation using htmlpreview (works on your fork, too):