Skip to content

Conversation

ktsakalozos
Copy link
Member

Description

We do not have a firewall configuration howto

Solution

Add a howto

Checklist

  • PR title formatted as type: title
  • Covered by unit tests
  • Covered by integration tests
  • Documentation updated
  • CLA signed
  • Backport label added if necessary

@ktsakalozos ktsakalozos requested a review from a team as a code owner July 11, 2025 11:22
Copy link
Contributor

@nhennigan nhennigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Kos! I think this is an important page that many users will need. I have left a few comments but they are mainly minor nits

net.ipv4.ip_forward=1
```

Apply immediately:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you have to do it immediately? Is the timing important?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here immediately means "without rebooting the system".


## Install and enable UFW

To install Uncomplicated Firewall:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to install this on every node?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, UFW needs to be installed on all nodes.

## Allow CNI specific communication

The default CNI used in {{product}} is cilium.
Unless you are not disabling this network plugin and deploying your own,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion instead of the negative version of this sentence:
If you are using the default network plugin, you should consider the following firewall rules:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

Kubelet runs on all nodes, while the kube-controller-manager and
kube-scheduler run only on the control plane nodes:

Allow traffic on port 10250 on all nodes:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion to make it clear which port is for which service:

Kubelet runs on all nodes, so allow traffic on port 10250 on all nodes:
//code here sudo ufw allow 10250/tcp
The kube-controller-manager and
kube-scheduler run only on the control plane nodes so allow traffic on ports 10257 and 10259 on control plane nodes:
//code here sudo ufw allow 10257/tcp sudo ufw allow 10259/tcp

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


## Allow cluster formation

To form an HA cluster the datastore used by Kubernetes (dqlite/etcd) needs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To form an HA cluster the datastore used by Kubernetes (dqlite/etcd) needs
To form a High Availability (HA) cluster the datastore used by Kubernetes (dqlite/etcd) needs


```sh
tail -f /var/log/ufw.log
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What can you learn form these logs? Which ports are trying to be accessed? Maybe we should add a comment here along the lines of "you should be able to see where the traffic is being dropped" or "this may help you identify any other ports or services you need to enable with UTW"

@ktsakalozos ktsakalozos requested a review from nhennigan July 11, 2025 21:26
Copy link
Contributor

@louiseschmidtgen louiseschmidtgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of suggestions to improve the flow.

Comment on lines +3 to +4
In this how-to we present a set of firewall rules/guidelines
you should consider when setting up {{product}}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this how-to we present a set of firewall rules/guidelines
you should consider when setting up {{product}}.
This how-to presents a set of firewall rules/guidelines
that should be considered when setting up {{product}}.

(let's use an active voice)

Comment on lines +5 to +6
Be aware that these rules may be incompatible with your network setup
and we recommend you review and tune them to match your needs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a note can we format it accordingly please?
So starting with: ```{note}

Comment on lines +5 to +6
Be aware that these rules may be incompatible with your network setup
and we recommend you review and tune them to match your needs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Be aware that these rules may be incompatible with your network setup
and we recommend you review and tune them to match your needs.
Please be aware that these rules may be incompatible with your network setup, so we recommend reviewing and adjusting them to match your needs.

(active voice + causal conjunction)

Comment on lines +8 to +10
Also, be aware that for each service hosted in Kubernetes,
the firewall rules need to be reviewed as there might be
special requirements for each.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Also, be aware that for each service hosted in Kubernetes,
the firewall rules need to be reviewed as there might be
special requirements for each.
Also, please review the firewall rules for each service hosted in Kubernetes, as there might be
special requirements for each.

Comment on lines +17 to +19
- A machine with Ubuntu where you have installed
or you plan to install {{product}}.
- You have root or sudo access to the machine.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- A machine with Ubuntu where you have installed
or you plan to install {{product}}.
- You have root or sudo access to the machine.
- An ubuntu machine where {{product}} is installed or will be installed.
- Root or sudo access to the machine.

(active voice)

Comment on lines +140 to +141
If you are using the default network plugin (Cilium),
you should consider the following firewall rules.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you are using the default network plugin (Cilium),
you should consider the following firewall rules.
When using the default network plugin (Cilium),
consider the following firewall rules.


The logs will show you which packets are dropped, their destination
and source as well as the protocol used and the destination port.
This information may help you identify any other ports or services
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This information may help you identify any other ports or services
This information helps to identify any other ports or services

This information may help you identify any other ports or services
you need to enable within UFW.

To keep the resources used by UFW to a minimum you can disable logging:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To keep the resources used by UFW to a minimum you can disable logging:
After troubleshooting, keep the resources used by UFW to a minimum by disabling logging again:

sudo sysctl -w net.ipv4.ip_forward=1
```

Reload UFW:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Reload UFW:
Reload UFW to apply the changes:


## Allow access to the Kubernetes services

Services such as CoreDNS require access to the Kubernetes API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a link to CoreDNS docs here.

@nhennigan nhennigan mentioned this pull request Aug 7, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants