Question

How to retrieve ipv4 of a running kubernetes 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
Answer a question...

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
January 9, 2023

Hi there,

The API request that you have looks correct, however keep in mind the public IPv4 address of the Kubernetes master node will not be set if high availability is configured on the cluster. Can you confirm if this is the case for your cluster?

Best,

Bobby