k3s/examples/kubectl-container
Jess Frazelle cde5559d09
Update `gcloud docker` commands to use `gcloud docker -- ARGS`
We can then avoid the following warning:
```
WARNING: The '--' argument must be specified between gcloud specific args on the left and DOCKER_ARGS on the right. IMPORTANT: previously, commands allowed the omission of the --, and unparsed arguments were treated as implementation args. This usage is being deprecated and will be removed in March 2017.
This will be strictly enforced in March 2017. Use 'gcloud beta docker' to see new behavior.
```

Signed-off-by: Jess Frazelle <acidburn@google.com>
2016-10-10 13:42:34 -07:00
..
.gitignore allow kubectl to be built statically 2015-06-03 15:41:09 -07:00
Dockerfile Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Makefile Update `gcloud docker` commands to use `gcloud docker -- ARGS` 2016-10-10 13:42:34 -07:00
README.md Update the latestReleaseBranch to release-1.4 in the munger. 2016-09-01 14:40:55 -07:00
pod.json update examples/kubectl-container to v1 2015-06-10 11:33:15 -07:00

README.md

WARNING WARNING WARNING WARNING WARNING

PLEASE NOTE: This document applies to the HEAD of the source tree

If you are using a released version of Kubernetes, you should refer to the docs that go with that version.

The latest release of this document can be found [here](http://releases.k8s.io/release-1.4/examples/kubectl-container/README.md).

Documentation for other releases can be found at releases.k8s.io.

To access the Kubernetes API from a Pod one of the solution is to run kubectl proxy in a so-called sidecar container within the Pod. To do this, you need to package kubectl in a container. It is useful when service accounts are being used for accessing the API and the old no-auth KUBERNETES_RO service is not available. Since all containers in a Pod share the same network namespace, containers will be able to reach the API on localhost.

This example contains a Dockerfile and Makefile for packaging up kubectl into a container and pushing the resulting container image on the Google Container Registry. You can modify the Makefile to push to a different registry if needed.

Assuming that you have checked out the Kubernetes source code and setup your environment to be able to build it. The typical build step of this kubectl container will be:

$ cd examples/kubectl-container
$ make kubectl
$ make tag
$ make container
$ make push

It is not currently automated as part of a release process, so for the moment this is an example of what to do if you want to package kubectl into a container and use it within a pod.

In the future, we may release consistently versioned groups of containers when we cut a release, in which case the source of gcr.io/google_containers/kubectl would become that automated process.

pod.json is provided as an example of running kubectl as a sidecar container in a Pod, and to help you verify that kubectl works correctly in this configuration. To launch this Pod, you will need a configured Kubernetes endpoint and kubectl installed locally, then simply create the Pod:

$ kubectl create -f pod.json

Analytics