<p>According to Kubernetes API docs it is possible to create/list/delete pods, replication controllers and services:</p>

<p><a href="http://kubernetes.io/third_party/swagger-ui/#!/v1beta1" rel="noreferrer">http://kubernetes.io/third_party/swagger-ui/#!/v1beta1</a></p>

<p>However in the Google Container Engine documentation they don't seem to expose this API. The only resources you can manage through a REST API are clusters. Pods, replication controllers and services have to be managed using gcloud.</p>

<p>Is it possible to access the Kubernetes API when using Google Container Engine?</p>

<p>I created a <a href="http://blog.ctaggart.com/2016/09/accessing-kubernetes-api-on-google.html" rel="nofollow">blog post</a> just for this topic. It includes a video walkthrough of the code and demo. Essentially, you can get the Kubernetes credentials from the Google Container Engine API. Here is how to do it in golang:</p>

<pre><code>func newKubernetesClient(clstr *container.Cluster) (*kubernetes.Clientset, error) {
    cert, err := base64.StdEncoding.DecodeString(clstr.MasterAuth.ClientCertificate)
    if err != nil {
        return nil, err
    }
    key, err := base64.StdEncoding.DecodeString(clstr.MasterAuth.ClientKey)
    if err != nil {
        return nil, err
    }
    ca, err := base64.StdEncoding.DecodeString(clstr.MasterAuth.ClusterCaCertificate)
    if err != nil {
        return nil, err
    }
    config := &amp;rest.Config{
        Host:            clstr.Endpoint,
        TLSClientConfig: rest.TLSClientConfig{CertData: cert, KeyData: key, CAData: ca},
        Username:        clstr.MasterAuth.Username,
        Password:        clstr.MasterAuth.Password,
        // Insecure:        true,
    }
    kbrnts, err := kubernetes.NewForConfig(config)
    if err != nil {
        return nil, err
    }
    return kbrnts, nil
}
</code></pre>
