Question

How to retrieve IPv4 of a running cluster using DigitalOcean API?

I manually created a Kubernetes cluster using DO. Once it is provisioned, I requested the retrieve cluster API to get the “ipv4” of the cluster.

GET REQUEST ENDPOINT- ‘https://api.digitalocean.com/v2/kubernetes/clusters/2dc1377e-b7cd-4748-a3ab-1172ea5e6529

response:

{"kubernetes_cluster":{"id":"2dc1377e-b7cd-4748-a3ab-1172ea5e6529","name":"echo-cluster","region":"blr1","version":"1.25.4-do.0","cluster_subnet":"10.244.0.0/16","service_subnet":"10.245.0.0/16","vpc_uuid":"b8998521-1fe4-490c-9ca5-fefb8064bc08", 

"ipv4":"",

"endpoint":"https://2dc1377e-b7cd-4748-a3ab-1172ea5e6529.k8s.ondigitalocean.com","tags":["k8s","k8s:2dc1377e-b7cd-4748-a3ab-1172ea5e6529"],"node_pools":[{"id":"db947a30-8f4e-4e18-8689-cda755ede961","name":"echo-node","size":"s-2vcpu-4gb","count":2,"tags":["k8s","k8s:2dc1377e-b7cd-4748-a3ab-1172ea5e6529","k8s:worker"],"labels":null,"taints":[],"auto_scale":false,"min_nodes":0,"max_nodes":0,"nodes":[{"id":"93408395-e057-47f8-8f6a-71bb0fec6812","name":"echo-node-mkfos","status":{"state":"running"},"droplet_id":"334227005","created_at":"2023-01-04T09:33:46Z","updated_at":"2023-01-04T09:35:14Z"},{"id":"b483769e-6897-4095-a37f-12fe73379ddf","name":"echo-node-mkfo5","status":{"state":"running"},"droplet_id":"334227004","created_at":"2023-01-04T09:33:46Z","updated_at":"2023-01-04T09:35:14Z"}]}],"maintenance_policy":{"start_time":"5:00","duration":"4h0m0s","day":"any"},"auto_upgrade":false,"status":{"state":"running"},"created_at":"2023-01-04T09:33:46Z","updated_at":"2023-01-04T09:38:34Z","surge_upgrade":false,"registry_enabled":false,"ha":false,"supported_features":["cluster-autoscaler","docr-integration","ha-control-plane","token-authentication"]}}

As you can see in the response, i am not able to get the ipv4, how i will assign domain record to IP?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
April 14, 2023

Hi there,

Kubernetes clusters do not have a single public IP address that you can use to point a domain to. Instead, you’ll typically use LoadBalancer or Ingress resources to expose your services to the internet, and then point your domain to the IP address assigned to these resources.

You can follow the steps on how to do this here:

https://docs.digitalocean.com/products/kubernetes/how-to/add-load-balancers/

Hope that this helps!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.