-
Notifications
You must be signed in to change notification settings - Fork 32
docs: add a howto for configuring UFW #1642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | ||
``` |
There was a problem hiding this comment.
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"
Co-authored-by: Niamh Hennigan <[email protected]>
Co-authored-by: Niamh Hennigan <[email protected]>
Co-authored-by: Niamh Hennigan <[email protected]>
Co-authored-by: Niamh Hennigan <[email protected]>
Co-authored-by: Niamh Hennigan <[email protected]>
There was a problem hiding this 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.
In this how-to we present a set of firewall rules/guidelines | ||
you should consider when setting up {{product}}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
Be aware that these rules may be incompatible with your network setup | ||
and we recommend you review and tune them to match your needs. |
There was a problem hiding this comment.
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}
Be aware that these rules may be incompatible with your network setup | ||
and we recommend you review and tune them to match your needs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
- A machine with Ubuntu where you have installed | ||
or you plan to install {{product}}. | ||
- You have root or sudo access to the machine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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)
If you are using the default network plugin (Cilium), | ||
you should consider the following firewall rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reload UFW: | |
Reload UFW to apply the changes: |
|
||
## Allow access to the Kubernetes services | ||
|
||
Services such as CoreDNS require access to the Kubernetes API |
There was a problem hiding this comment.
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.
Description
We do not have a firewall configuration howto
Solution
Add a howto
Checklist
type: title