Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
How can I use API to set readiness probe for the deployment in javascript client

I'm new in node.js, so any comments and suggestion will be appreciated. Can anyone suggest me, how can I add readiness probe for the deployment using javascript client via k8s API.

Here below .js the script, that we are using to create deployment. I added readiness section under 'const container' section, but I'm not sure that this changes are correct.

const k8sApi = kc.makeApiClient(k8s.AppsV1Api);


const createDeploymentObject = ({
  sourceDeployment,
  namespace,
  account,
  deploymentName,
}) => k8sApi.readNamespacedDeployment(sourceDeployment, namespace)
  .then((response) => {
    const {
      apiVersion,
      kind,
      metadata: {
        labels,
        name,
      },
      spec,
    } = response.body;
    const deployment = {
      apiVersion,
      kind,
      metadata: {
        labels,
        name,
        namespace,
      },
      spec,
    }; 
    deployment.metadata.name = deploymentName
      || helpers.createK8sName(deployment.metadata.name, account);
    deployment.metadata.labels.aid = account;
    deployment.spec.replicas = 1;
    deployment.spec.selector.matchLabels.aid = account;
    deployment.spec.template.metadata.labels.aid = account;
    const envServiceId = deployment.spec.template.spec.containers
      .find((c) => c.name === 'cp-ksql-server')
      .env
      .find((e) => e.name === 'KSQL_KSQL_SERVICE_ID');
    envServiceId.value = helpers.createKsqlServiceId(account);
    const container = deployment.spec.template.spec.containers.find((c) => c.name === 'cp-ksql-server');
    container.readinessProbe = {
    exec: {
    command: ['/bin/bash', '-c', 'curl -s -m 2 http://localhost:8088/healthcheck | grep true']},
    initialDelaySeconds: 30,
    periodSeconds: 10,
    successThreshold: 1,
    timeoutSeconds: 1,
    failureThreshold: 3
    };
    console.log(JSON.stringify(container, null, 2));
    return deployment;
  });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!