Question

Possible external IP addresses for my k8s cluster

Hi, some API providers (e.g. for a database), allow you to configure a filter on their side to only accept traffic from certain IP address blocks.

Is there a reasonable way to restrict the set of IPs my k8s cluster uses when sending traffic outside of the cluster such that I could configure this list?

I’m aware this is support for reserved IPs, but not clear how integrated it is with k8s (https://docs.digitalocean.com/products/networking/reserved-ips/how-to/outbound-traffic/).

Or if not, possibly the DigitalOcean-wide set of IP addresses that may be used, thus limiting attacks to running on DigitalOcean?

Thanks!

Kyle


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

Hi there,

Indeed with Kubernetes, especially on cloud platforms like DigitalOcean, the outgoing traffic from the cluster typically originates from a range of IPs that are dynamically allocated by the cloud provider.

DigitalOcean does support reserved IPs, and these can be used to ensure that outbound traffic from your cluster comes from a predictable IP address. But that is mainly for Droplets.

To implement this with a DOKS cluster, one option would be to use a Static Routes Operator as described here:

https://github.com/digitalocean/k8s-staticroute-operator

Another option is to use an Egress Gateway via Crossplane with DigitalOcean CRD. Here is a guide on how to do that:

https://github.com/digitalocean/container-blueprints/tree/main/DOKS-Egress-Gateway

I could suggest testing this out on a staging or a test cluster before trying the implementation on your production environment!

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

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

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

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

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