All skills
google avatar

/gke-basics

@9ad3d2b
by googlegoogle/skills21k stars
1,698

Manages core GKE cluster provisioning, credentials, Autopilot vs Standard selection, and workload deployment. Use when creating GKE clusters, fetching kubectl credentials, or deciding between Autopilot and Standard modes. Don't use for Workload Identity (use gke-workload-identity), GKE networking (use gke-networking), security hardening (use gke-platform-security or gke-workload-security), or cluster upgrades (use gke-upgrades).

Use this Skill: https://skilld.dev/gh/google/skills/gke-basics

This session only. Nothing lands on disk.

referencesclient-library-usage.md

≈611 tokens on demand. Your agent reads this file only when SKILL.md points to it.

GKE Client Libraries

To interact with the GKE (Kubernetes) API programmatically, use the official Kubernetes client libraries.

Prerequisite: These libraries interact with the Kubernetes API. You must already have a running GKE cluster and valid credentials (for example, by running gcloud container clusters get-credentials) before running this code.

Getting Started

Kubernetes client libraries allow you to manage clusters and workloads from within your application code.

Python

  • Installation:

    pip install kubernetes
  • Usage Example:

    from kubernetes import client, config
    config.load_kube_config() # Loads from ~/.kube/config
    v1 = client.CoreV1Api()
    print("Listing pods with their IPs:")
    ret = v1.list_pod_for_all_namespaces(watch=False)
    for i in ret.items:
        print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))

Go

  • Installation:

    go get k8s.io/client-go@latest
  • Usage Example:

    import (
        "k8s.io/client-go/kubernetes"
        "k8s.io/client-go/tools/clientcmd"
    )
    config, _ := clientcmd.BuildConfigFromFlags("", kubeconfig)
    clientset, _ := kubernetes.NewForConfig(config)
    pods, _ := clientset.CoreV1().Pods("").List(
        context.Background(), metav1.ListOptions{})

Node.js (TypeScript)

  • Installation:

    npm install @kubernetes/client-node
  • Usage Example:

    const k8s = require('@kubernetes/client-node');
    
    const kc = new k8s.KubeConfig();
    kc.loadFromDefault(); // Automatically detects local vs. in-cluster configuration
    
    const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
    
    // In most recent library versions, parameters must be passed inside an object
    k8sApi.listNamespacedPod({ namespace: 'default' }).then((res) => {
        const pods = res.items || res.body.items;
        console.log(`Found ${pods.length} pods in 'default' namespace.`);
    });

Java

GKE-specific API (Container Service)

To manage the GKE service itself (e.g., create/delete clusters) programmatically, use the Google Cloud Container client libraries.

Source: SKILL.md on GitHub

1 warning1d3 checks · Risk SAFE
  • Gen Agent Trust Hub1d

    This skill provides a comprehensive guide for managing Google Kubernetes Engine (GKE) clusters, following Google Cloud's established best practices for security and provisioning. It includes potential considerations regarding the handling of Kubernetes manifests and external libraries, which are standard for cloud infrastructure management tools.

  • Socket1d

    No alerts

  • Snyk1d

    Risk: MEDIUM · 1 issue

Signed by skilld at 9ad3d2b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 days ago
metadata
{
  "version": "1.1.1",
  "category": "Containers"
}

README badge

README badge for google/skills/gke-basics