Table of Contents
docker psdon’t show it.
At least Docker
1.10+. Ensure the Docker daemon is running and can be contacted (try
ps). Some of the Kubernetes components need to run as root, which normally
works fine with docker.
You need an etcd in your path, please make sure it is installed and in your
You need OpenSSL installed. If you do not have the
openssl command available, the script will print an appropriate error.
The CFSSL binaries (cfssl, cfssljson) must be installed and available on your
The easiest way to get it is something similar to the following:
$ go get -u github.com/cloudflare/cfssl/cmd/... $ PATH=$PATH:$GOPATH/bin
In order to run kubernetes you must have the kubernetes code on the local machine. Cloning this repository is sufficient.
The `--depth=1` parameter is optional and will ensure a smaller download. ### Starting the cluster In a separate tab of your terminal, run the following (since one needs sudo access to start/stop Kubernetes daemons, it is easier to run the entire script as root): ```sh cd kubernetes hack/local-up-cluster.sh
This will build and start a lightweight local cluster, consisting of a master and a single node. Type Control-C to shut it down.
If you’ve already compiled the Kubernetes components, then you can avoid rebuilding them with this script by using the
You can use the cluster/kubectl.sh script to interact with the local cluster. hack/local-up-cluster.sh will print the commands to run to point kubectl at the local cluster.
Your cluster is running, and you want to start running containers!
You can now use any of the cluster/kubectl.sh commands to interact with your local setup.
cluster/kubectl.sh get pods cluster/kubectl.sh get services cluster/kubectl.sh get replicationcontrollers cluster/kubectl.sh run my-nginx --image=nginx --replicas=2 --port=80 ## begin wait for provision to complete, you can monitor the docker pull by opening a new terminal sudo docker images ## you should see it pulling the nginx image, once the above command returns it sudo docker ps ## you should see your container running! exit ## end wait ## introspect Kubernetes! cluster/kubectl.sh get pods cluster/kubectl.sh get services cluster/kubectl.sh get replicationcontrollers
Note the difference between a container
and a pod. Since you only asked for the former, Kubernetes will create a wrapper pod for you.
However you cannot view the nginx start page on localhost. To verify that nginx is running you need to run
curl within the docker container (try
You can control the specifications of a pod via a user defined manifest, and reach nginx through your browser on the port specified therein:
cluster/kubectl.sh create -f test/fixtures/doc-yaml/user-guide/pod.yaml
Some firewall software that uses iptables may not interact well with
kubernetes. If you have trouble around networking, try disabling any
firewall or other iptables-using systems, first. Also, you can check
if SELinux is blocking anything by running a command such as
journalctl --since yesterday | grep avc.
By default the IP range for service cluster IPs is 10.0.. - depending on your docker installation, this may conflict with IPs for containers. If you find containers running with IPs in this range, edit hack/local-cluster-up.sh and change the service-cluster-ip-range flag to something else.
You are running a single node setup. This has the limitation of only supporting a single replica of a given pod. If you are interested in running with larger replica sizes, we encourage you to try the local vagrant setup or one of the cloud providers.
cd kubernetes make hack/local-up-cluster.sh
docker psdon’t show it.
One or more of the Kubernetes daemons might’ve crashed. Tail the logs of each in /tmp.
To start the DNS service, you need to set the following variables:
KUBE_ENABLE_CLUSTER_DNS=true KUBE_DNS_SERVER_IP="10.0.0.10" KUBE_DNS_DOMAIN="cluster.local"
To know more on DNS service you can check out the docs.