מדריך למתחילים בנושא ספריית לקוח

משתמשים בספריית הלקוח של GKE cluster admin ל-Node.js.

דוגמת קוד

Node.js

כדי לבצע אימות ב-GKE, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

const container = require('@google-cloud/container');

// Create the Cluster Manager Client
const client = new container.v1.ClusterManagerClient();

async function quickstart() {
  const zone = 'us-central1-a';
  const projectId = await client.getProjectId();
  const request = {
    projectId: projectId,
    zone: zone,
  };

  const [response] = await client.listClusters(request);
  console.log('Clusters: ', response);
}
quickstart();

המאמרים הבאים

כדי לחפש ולסנן דוגמאות קוד למוצרים אחרים של Google Cloud , אפשר להיעזר בדפדפן לדוגמאות שלGoogle Cloud .