Not running Linux? Consider running Linux in a local virtual machine with Vagrant, or on a cloud provider like Google Compute Engine
At least Docker 1.0.0+. Ensure the Docker daemon is running and can be contacted (try docker ps
). Some of the kubernetes components need to run as root, which normally works fine with docker.
You need an etcd somewhere in your path. Get the latest release and place it in /usr/bin
.
In a separate tab of your terminal, run:
cd kubernetes
sudo hack/local-up-cluster.sh
This will build and start a lightweight local cluster, consisting of a master and a single minion. Type Control-C to shut it down.
You can use the cluster/kubecfg.sh script to interact with the local cluster. You must set the KUBERNETES_MASTER environment variable to let other programs know how to reach your master.
export KUBERNETES_MASTER=http://localhost:8080
Your cluster is running, and you want to start running containers!
You can now use any of the cluster/kubecfg.sh commands to interact with your local setup.
cluster/kubecfg.sh list /pods
cluster/kubecfg.sh list /services
cluster/kubecfg.sh list /replicationControllers
cluster/kubecfg.sh -p 8080:80 run dockerfile/nginx 1 myNginx
## 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 dockerfile/nginx image, once the above command returns it
sudo docker ps
## you should see your container running!
exit
## end wait
## introspect kubernetes!
cluster/kubecfg.sh list /pods
cluster/kubecfg.sh list /services
cluster/kubecfg.sh list /replicationControllers
Congratulations!
Some firewall software that uses iptables may not interact well with kubernetes. If you're having trouble around networking, try disabling any firewall or other iptables-using systems, first.
By default the IP range for service portals 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 portal_net flag to something else.
You are running a single minion 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
hack/build-go.sh
hack/local-up-cluster.sh