Learn to use Talos Linux Ingress Firewall to limit access to the host services.
apid
and kubelet
), and any additional workloads that may be running on the host.
Talos Linux Ingress Firewall doesn’t affect the traffic between the Kubernetes pods/services, please use CNI Network Policies for that.
Note: If you use another tool that provides node level network filtering (e.g. Cilium Host Firewall) it may take precedence in the nftables chain and bypass OS level rules.
accept
or block
, with the default being accept
.
If the default action is set to accept
, then all ingress traffic will be allowed, unless there is a matching rule that blocks it.
If the default action is set to block
, then all ingress traffic will be blocked, unless there is a matching rule that allows it.
With either accept
or block
, traffic is always allowed on the following network interfaces:
lo
siderolink
kubespan
block
mode:
NetworkRuleConfig
might be repeated many times to define multiple rules, but each document must have a unique name.
The ports
field accepts either a single port or a port range:
protocol
might be either tcp
or udp
.
The ingress
specifies the list of subnets that are allowed to access the host services, with the optional except
field to exclude a set of addresses from the subnet.
Note: incorrect configuration of the ingress firewall might result in the host becoming inaccessible over Talos API.
It is recommended that the configuration be applied in --mode=try
to ensure it is reverted in case of a mistake.
block
mode, the ingress firewall will also block encapsulated traffic (e.g. VXLAN) between the nodes, which needs to be explicitly allowed for the Kubernetes
networking to function properly.
Please refer to the documentation of the CNI in use for the specific ports required.
Some default configurations are listed below:
vxlan
UDP port 4789vxlan
UDP port 8472$CLUSTER_SUBNET
, e.g. 172.20.0.0/24
- the subnet which covers all machines in the cluster$CP1
, $CP2
, $CP3
- the IP addresses of the controlplane nodes$VXLAN_PORT
- the UDP port used by the CNI for encapsulated trafficapid
and Kubernetes API are wide openkubelet
and trustd
API are only accessible within the clusteretcd
API is limited to controlplane nodeskubelet
and apid
API are only accessible within the clusternftables
to perform the filtering.
With the default action set to accept
, the following rules are applied (example):
block
, the following rules are applied (example):
nftable
configuration can be inspected with talosctl get nftableschain -o yaml
.
The Ingress Firewall documents can be extracted from the machine config with the following command:
talosctl get mc v1alpha1 -o yaml | yq .spec | yq 'select(.kind == "NetworkDefaultActionConfig"),select(.kind == "NetworkRuleConfig" )'