Here is an example of creating a managed Kubernete...
# general
Here is an example of creating a managed Kubernetes cluster on DigitalOcean.
Copy code
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 
Copy code
const _default = new digitalocean.Domain("default", {name: "<|>"});

// This code doesn't work because foo.nodePool is just the inputs.
const dnsRecords = foo.nodePool.nodes(node => new digitalocean.DnsRecord("www", {
    type: "A",
    value: node.ipv4Address,
I assume I have to either use the async methods such as
Copy code
function getKubernetesCluster(args: GetKubernetesClusterArgs, opts?: InvokeOptions): Promise<GetKubernetesClusterResult>
But the problem then is I can't pass the cluster ID to this method as the resource has not bee provisioned yet when this method is called. I also thought of generating a resource using the static
method defined on the resource but I also don't think I have the ID of the cluster to call this method yet.
Copy code
public static get(name: string, id: Input<ID>, state?: KubernetesClusterState, opts?: CustomResourceOptions): KubernetesCluster
hmm, are you sure that nodePool doesn’t have any outputs?
I’ve got one DO setup with k8s cluster so I can check it myself - gimme me a second.
Ok, looking at the docs it does not contain IP address 🤔
Anyway - is it really a good idea to acquire a k8s node address? Do you have any guarantee it’s gonna be static? Usually, if you want to do some ingress in k8s, you should request a load balancer within it.
@freezing-umbrella-80278 I responded to your StackOverflow post:
happy to elaborate on the answer here if you need more info
@billowy-army-68599 much appreciated will give it a go in a bit.
Damn, you were faster @billowy-army-68599 😛 Was about to write something quite similar.
😉 1
@prehistoric-activity-61023 that's a good question it would appear provided the droplet isn't destroyed it is indeed static. You're right I should be using a load balancer, but I'm trying to build an ultra-cheapo cluster I can use to just play around with. I suppose if I ever needed to migrate I would just build a new cluster with a load balancer and add that to the DNS entries, then remove the DNS for the old cluster and wait for the traffic to fully drain before destroying it.
@billowy-army-68599 doesn't
return a promise and therefore need to be awaited?
@freezing-umbrella-80278 I can imagine. I have k8s cluster on DO for pretty the same reason (I’d like to use GCP but it’s too expensive for my private, non-commercial project). Still, simple LB is pretty cheap on DO ($10/month) so you might save yourself some trouble and try to go that way.
@prehistoric-activity-61023 I was doing a 2 node, 1 LB cluster before on DO which was $30 a month
My current setup will only cost me $10 a month
As I'm just paying for a single node
I also found out DigitalOcean run the control plane on a managed master node independent of the one in your pool
So you basically get a 2 node cluster for $10 a month 😄
I see. Right now I’ve got 3xs-1vcpu-2gb + LB + container registry and it costs about ~$45
Yeah that's too rich for my blood, I'll wait until I have something worth spending that kind of cheddar on. 😄
I wouldn’t call it a 2 node cluster 😉 Most of the cloud offerings include control plane separately (even o GCP you can get one zonal control plane for free).
Just keep in mind that if DO decides to replace your node or sth goes wrong, you’re definitely going to have some downtime.
Fair enough, if feels like it's free because I still remember using Typhoon to deploy a k8s cluster to DO before they had their managed product. 😄
…and I used to think I know a lot about k8s.. I’ve never heard of Typhoon project.
Anyway, building your own k8s cluster is not the best job in the world 😉
Yeah it wasn't much fun to maintain, much happier now DO provides managed k8s
doesn't digitalocean.getDropletOutput return a promise and therefore need to be awaited?
Only if you're doing some string manipulation, if you're passing the result to another resource, Pulumi will figure it out for you
@billowy-army-68599 sounds like black magic. So does Pulumi register under the hood that
is actually a pending promise and you're attempting to access
when constructing the
. So the graph is created and then Pulumi will ensure the previous dependency and it's outputs are available before resolving the
it does it inside the engine, but yes that's right.
is like saying "wait for this thing to resolve"
is similar
That's awesome, thank you both for your help.
@freezing-umbrella-80278 if my SO answer helped, would be great to accept the answer