How to use kubernetes API on localhost?

2/4/2016

I had set up the kubernetes server on my local machine by using docker.

docker run \
    --volume=/:/rootfs:ro \
    --volume=/sys:/sys:ro \
    --volume=/dev:/dev \
    --volume=/var/lib/docker/:/var/lib/docker:rw \
    --volume=/var/lib/kubelet/:/var/lib/kubelet:rw \
    --volume=/var/run:/var/run:rw \
    --net=host \
    --pid=host \
    --privileged=true \
    -d \
    gcr.io/google_containers/hyperkube-amd64:v1.2.0-alpha.6 \
    /hyperkube kubelet \
        --containerized \
        --hostname-override="127.0.0.1" \
        --address="0.0.0.0" \
        --api-servers=http://localhost:8080 \
        --config=/etc/kubernetes/manifests \
        --cluster-dns=10.0.0.10 \
        --cluster-domain=cluster.local \
        --allow-privileged=true --v=10

I had found this link for RESTful services on Google Container. How to do a RESTful call in local machine.

For example: To create a cluster on Google container here is the RESTful end point

POST /v1/projects/{projectId}/zones/{zone}/clusters

where projectId is available on the google container and zone is where the Google contanier is hosted.

I need a similar link as above to create clusters, pods,.... through a RESTful service in localmachine?

Thank you in advance.

-- zakir
google-compute-engine
google-kubernetes-engine
kubernetes

1 Answer

2/4/2016

The service you found at https://cloud.google.com/container-engine/reference/rest/ is for creating clusters in Google Container Engine. If you already have a local cluster, you don't need GKE.

You should be able to create pods, services, etc. by hitting http://localhost:8080.

Try going all the way through this guide.

-- CJ Cullen
Source: StackOverflow