cloudmgmtkubernetes

module
v0.0.0-...-e20f597 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2014 License: Apache-2.0

README

Kubernetes

Kubernetes is an open source implementation of container cluster management.

Kubernetes Design Document - Kubernetes @ Google I/O 2014

GoDoc Travis

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.

Contents

Where to go next?

Check out examples of Kubernetes in action, and community projects in the larger ecosystem:

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!

The Kubernetes team is hanging out on IRC on the #google-containers room on freenode.net. We also have the google-containers Google Groups mailing list.

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.

Development

Go development environment

Kubernetes is written in Go programming language. If you haven't set up Go development environment, please follow this instruction to install go tool and set up GOPATH.

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 git@github.com:GoogleCloudPlatform/kubernetes.git

The commands above will not work if there are more than one directory in $GOPATH.

godep and dependency management

Kubernetes uses godep to manage dependencies. It is not required for building Kubernetes but it is required when managing dependencies under the Godeps/ tree. Please make sure that godep is installed and in your $PATH.

Installing godep

There are many ways to build and host go binaries. Here is an easy way to get utilities like godep installed:

  1. Ensure that mercurial is installed on your system. (some of godep's dependencies use the mercurial source control system). Use apt-get install mercurial or yum install mercurial on Linux, or brew.sh on OS X, or download directly from mercurial.
  2. Create a new GOPATH for your tools and install godep:
GOPATH=$HOME/src/go-tools
mkdir -p $GOPATH
go get github.com/tools/godep
  1. Add $HOME/src/go-tools/bin to your path. Typically you'd add this to your ~/.profile:
export PATH=$PATH:$HOME/src/go-tools/bin
Using godep

Here is a quick summary of godep. godep helps manage third party dependencies by copying known versions into Godep/_workspace. You can use godep in three ways:

  1. Use godep to call your go commands. For example: godep go test ./...
  2. Use godep to modify your $GOPATH so that other tools know where to find the dependencies. Specifically: export GOPATH=$GOPATH:$(godep path)
  3. Use godep to copy the saved versions of packages into your $GOPATH. This is done with godep restore.

We recommend using options #1 or #2.

Hooks

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.

NOTE: The ../.. 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
Unit tests
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
Coverage
cd kubernetes
godep go tool cover -html=target/c.out
Integration tests

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
End-to-End tests

With a GCE account set up for running cluster/kube-up.sh (see Setup above):

cd kubernetes
hack/e2e-test.sh
Testing out flaky tests

Instructions here

Add/Update dependencies

Kubernetes uses godep to manage dependencies. To add or update a package, please follow the instructions on godep's document.

To add a new package foo/bar:

  • Download foo/bar into the first directory in GOPATH: go get foo/bar.
  • Change code in kubernetes to use foo/bar.
  • Run godep save ./... under kubernetes' root directory.

To update a package foo/bar:

  • Update the package with go get -u foo/bar.
  • Change code in kubernetes accordingly if necessary.
  • Run 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):

http://htmlpreview.github.io/?https://github.com/GoogleCloudPlatform/kubernetes/blob/master/api/kubernetes.html

Directories

Path Synopsis
Godeps
_workspace/src/code.google.com/p/go-uuid/uuid
The uuid package generates and inspects UUIDs.
The uuid package generates and inspects UUIDs.
_workspace/src/code.google.com/p/go.net/html
Package html implements an HTML5-compliant tokenizer and parser.
Package html implements an HTML5-compliant tokenizer and parser.
_workspace/src/code.google.com/p/go.net/html/atom
Package atom provides integer codes (also known as atoms) for a fixed set of frequently occurring HTML strings: tag names and attribute keys such as "p" and "id".
Package atom provides integer codes (also known as atoms) for a fixed set of frequently occurring HTML strings: tag names and attribute keys such as "p" and "id".
_workspace/src/code.google.com/p/go.net/html/charset
Package charset provides common text encodings for HTML documents.
Package charset provides common text encodings for HTML documents.
_workspace/src/code.google.com/p/go.net/websocket
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
_workspace/src/code.google.com/p/goauth2/compute/serviceaccount
Package serviceaccount provides support for making OAuth2-authorized HTTP requests from Google Compute Engine instances using service accounts.
Package serviceaccount provides support for making OAuth2-authorized HTTP requests from Google Compute Engine instances using service accounts.
_workspace/src/code.google.com/p/goauth2/oauth
The oauth package provides support for making OAuth2-authenticated HTTP requests.
The oauth package provides support for making OAuth2-authenticated HTTP requests.
_workspace/src/code.google.com/p/goauth2/oauth/example
This program makes a call to the specified API, authenticated with OAuth2.
This program makes a call to the specified API, authenticated with OAuth2.
_workspace/src/code.google.com/p/goauth2/oauth/jwt
The jwt package provides support for creating credentials for OAuth2 service account requests.
The jwt package provides support for creating credentials for OAuth2 service account requests.
_workspace/src/code.google.com/p/goauth2/oauth/jwt/example
This program makes a read only call to the Google Cloud Storage API, authenticated with OAuth2.
This program makes a read only call to the Google Cloud Storage API, authenticated with OAuth2.
_workspace/src/code.google.com/p/google-api-go-client/compute/v1
Package compute provides access to the Compute Engine API.
Package compute provides access to the Compute Engine API.
_workspace/src/code.google.com/p/google-api-go-client/googleapi
Package googleapi contains the common code shared by all Google API libraries.
Package googleapi contains the common code shared by all Google API libraries.
_workspace/src/code.google.com/p/google-api-go-client/googleapi/transport
Package transport contains HTTP transports used to make authenticated API requests.
Package transport contains HTTP transports used to make authenticated API requests.
_workspace/src/github.com/fsouza/go-dockerclient
Package docker provides a client for the Docker remote API.
Package docker provides a client for the Docker remote API.
_workspace/src/github.com/fsouza/go-dockerclient/testing
Package testing provides a fake implementation of the Docker API, useful for testing purpose.
Package testing provides a fake implementation of the Docker API, useful for testing purpose.
_workspace/src/github.com/golang/glog
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
_workspace/src/github.com/google/gofuzz
Package fuzz is a library for populating go objects with random values.
Package fuzz is a library for populating go objects with random values.
_workspace/src/github.com/stretchr/objx
objx - Go package for dealing with maps, slices, JSON and other data.
objx - Go package for dealing with maps, slices, JSON and other data.
_workspace/src/github.com/stretchr/testify/mock
Provides a system by which it is possible to mock your objects and verify calls are happening as expected.
Provides a system by which it is possible to mock your objects and verify calls are happening as expected.
_workspace/src/gopkg.in/v1/yaml
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.
build
cmd
apiserver
apiserver is the main api server and master for the cluster.
apiserver is the main api server and master for the cluster.
controller-manager
The controller manager is responsible for monitoring replication controllers, and creating corresponding pods to achieve the desired state.
The controller manager is responsible for monitoring replication controllers, and creating corresponding pods to achieve the desired state.
integration
A basic integration test for the service.
A basic integration test for the service.
kubelet
The kubelet binary is responsible for maintaining a set of containers on a particular host VM.
The kubelet binary is responsible for maintaining a set of containers on a particular host VM.
Examples contains sample applications for trying out the concepts in Kubernetes.
Examples contains sample applications for trying out the concepts in Kubernetes.
pkg
api
Package api includes all types used to communicate between the various parts of the Kubernetes system.
Package api includes all types used to communicate between the various parts of the Kubernetes system.
api/v1beta1
Package v1beta1 is the v1beta1 version of the API
Package v1beta1 is the v1beta1 version of the API
apiserver
Package apiserver contains the code that provides a RESTful api service
Package apiserver contains the code that provides a RESTful api service
client
Package client contains the implementation of the client side communication with the Kubernetes master.
Package client contains the implementation of the client side communication with the Kubernetes master.
client/cache
Package cache is a client-side caching mechanism.
Package cache is a client-side caching mechanism.
cloudprovider
Package cloudprovider supplies interfaces and implementations for cloud service providers
Package cloudprovider supplies interfaces and implementations for cloud service providers
constraint
Package constraint has functions for ensuring that collections of containers are allowed to run together on a single host.
Package constraint has functions for ensuring that collections of containers are allowed to run together on a single host.
controller
Package controller contains logic for watching and synchronizing replicationControllers.
Package controller contains logic for watching and synchronizing replicationControllers.
conversion
Package conversion provides go object versioning and encoding/decoding mechanisms.
Package conversion provides go object versioning and encoding/decoding mechanisms.
election
Package election provides interfaces used for master election.
Package election provides interfaces used for master election.
health
Package health contains utilities for health checking, as well as health status information.
Package health contains utilities for health checking, as well as health status information.
healthz
Package healthz implements basic http server health checking.
Package healthz implements basic http server health checking.
httplog
Package httplog contains a helper object and functions to maintain a log along with an http response.
Package httplog contains a helper object and functions to maintain a log along with an http response.
kubecfg
Package kubecfg is a set of libraries that are used by the kubecfg command line tool.
Package kubecfg is a set of libraries that are used by the kubecfg command line tool.
kubelet
Package kubelet is the package that contains the libraries that drive the Kubelet binary.
Package kubelet is the package that contains the libraries that drive the Kubelet binary.
kubelet/config
Reads the pod configuration from etcd using the Kubernetes etcd schema
Reads the pod configuration from etcd using the Kubernetes etcd schema
labels
Package labels implements a simple label system, parsing and matching selectors with sets of labels.
Package labels implements a simple label system, parsing and matching selectors with sets of labels.
master
Package master contains code for setting up and running a Kubernetes cluster master.
Package master contains code for setting up and running a Kubernetes cluster master.
proxy
Package proxy implements the layer-3 network proxy.
Package proxy implements the layer-3 network proxy.
proxy/config
Package config provides decoupling between various configuration sources (etcd, files,...) and the pieces that actually care about them (loadbalancer, proxy).
Package config provides decoupling between various configuration sources (etcd, files,...) and the pieces that actually care about them (loadbalancer, proxy).
registry
Package registry implements the storage and system logic for the core of the api server.
Package registry implements the storage and system logic for the core of the api server.
registry/binding
Package binding contains the middle layer logic for bindings.
Package binding contains the middle layer logic for bindings.
scheduler
Package scheduler contains a generic Scheduler interface and several implementations.
Package scheduler contains a generic Scheduler interface and several implementations.
tools
Package tools implements general tools which depend on the api package.
Package tools implements general tools which depend on the api package.
util
Package util implements various utility functions used in both testing and implementation of Kubernetes.
Package util implements various utility functions used in both testing and implementation of Kubernetes.
util/config
Package config provides utility objects for decoupling sources of configuration and the actual configuration state.
Package config provides utility objects for decoupling sources of configuration and the actual configuration state.
util/wait
Package wait provides tools for polling or listening for changes to a condition.
Package wait provides tools for polling or listening for changes to a condition.
version
Package version supplies version information collected at build time to kubernetes components.
Package version supplies version information collected at build time to kubernetes components.
version/flag
Package flag defines utility functions to handle command line flags related to version of Kubernetes.
Package flag defines utility functions to handle command line flags related to version of Kubernetes.
volume
Package volume includes internal representations of external volume types as well as utility methods required to mount/unmount volumes to kubelets.
Package volume includes internal representations of external volume types as well as utility methods required to mount/unmount volumes to kubelets.
watch
Package watch contains a generic watchable interface, and a fake for testing code that uses the watch interface.
Package watch contains a generic watchable interface, and a fake for testing code that uses the watch interface.
plugin
pkg/scheduler/factory
Package factory can set up a scheduler.
Package factory can set up a scheduler.
test
integration
Package integration provides integration tests for Kubernetes.
Package integration provides integration tests for Kubernetes.
third_party

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL