We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 932c2fb + c299acf commit a93f9c6Copy full SHA for a93f9c6
examples/scale-deployment.js
@@ -0,0 +1,22 @@
1
+const k8s = require('@kubernetes/client-node');
2
+
3
+const kc = new k8s.KubeConfig();
4
+kc.loadFromDefault();
5
6
+const k8sApi = kc.makeApiClient(k8s.AppsV1Api);
7
8
+const targetDeploymentName = 'docker-test-deployment';
9
10
+async function scale(namespace, name, replicas) {
11
+ // find the particular deployment
12
+ const res = await k8sApi.readNamespacedDeployment(name, namespace);
13
+ let deployment = res.body;
14
15
+ // edit
16
+ deployment.spec.replicas = replicas;
17
18
+ // replace
19
+ await k8sApi.replaceNamespacedDeployment(name, namespace, deployment);
20
+}
21
22
+scale('default', 'docker-test-deployment', 3);
0 commit comments