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

157
Views
How to get the cluster node IPs using Pulumi

Here is an example of creating a managed Kubernetes cluster on DigitalOcean.

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const foo = new digitalocean.KubernetesCluster("foo", {
    region: "nyc1",
    version: "1.20.2-do.0",
    nodePool: {
        name: "front-end-pool",
        size: "s-2vcpu-2gb",
        nodeCount: 3,
    },
});

Example code taken from the Pulumi DigitalOcean package documentation.

How do I retrieve the droplet node IPv4 addresses for use in say creating DnsRecord resources?

const _default = new digitalocean.Domain("default", {name: "example.com"});

// This code doesn't work because foo.nodePool is just the inputs.
const dnsRecords = foo.nodePool.nodes(node => new digitalocean.DnsRecord("www", {
    domain: _default.name,
    type: "A",
    value: node.ipv4Address,
}));
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

DigitalOcean doesn't return a list of node IP addresses from the Kubernetes cluster you created. You can retrieve these values using the getDroplet function.

However, you'll need to do this iteration inside an apply() like so:

const addresses = foo.nodePool.nodes.apply(
    nodes => nodes.forEach(
        (node) => {
            let n = digitalocean.getDropletOutput({
                name: node.name
            })
            new digitalocean.DnsRecord("www", {
                domain: domain.name,
                type: "A",
                value: n.ipv4Address,
            })
        }
    )
)

Using an apply here lets us wait until the foo.nodePool.nodes has been created by the API. We can then iterate over it like a normal array, get the droplet, assign it to the variable n and then create a new DNS record for each of the nodes

about 4 years ago · Juan Pablo Isaza Report
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!