Kernel parameters
CGW deployments have long configured network parameters through CNI plugins or
init containers. The chart's sysctls value is another option: it sets them in
the Pod specification before containers start. This page compares the available
mechanisms and their constraints.
What a gateway needs
Safe? is Kubernetes' isolation classification, not a recommendation. A
gateway normally needs forwarding, reverse-path-filtering, and VTI settings,
but Kubernetes classifies them as unsafe and requires kubelet configuration.
ping_group_range is optional.
Setting them through the chart
sysctls is a list of name/value entries and lands in the pod's
securityContext:
Kubernetes applies them before containers, including init containers, start.
Two details:
valueis a string in the Kubernetes API.additionalPodSpec.securityContextis retained. If both the root-levelsysctlsvalue andadditionalPodSpec.securityContext.sysctlsare set, the root-levelsysctlslist replaces the latter. Other fields inadditionalPodSpec.securityContext, such asrunAsUser, are unchanged.
Enable IPv6 routing
all covers existing interfaces; default covers those created later. IPv6
forwarding disables autoconfiguration and router-advertisement acceptance. Set
net.ipv6.conf.<interface>.accept_ra to 2 when the gateway needs an RA.
The node has to allow it
Kubernetes permits a small, release-specific safe set. Most router settings fall outside it because they change network behavior, not because they are wrong for CGW. They need node-level enablement; check the upstream listOpens in a new tab for the Kubernetes version in use.
Everything else is unsafe and has to be allowed per node, by starting the kubelet with the parameter listed:
Allow unsafe parameters on every node where CGW may run, preferably through the node-pool definition. For managed clusters where kubelet flags are unavailable, see other ways.
A Pod requesting a disallowed parameter is scheduled but does not start:
Older kubelets use not whitelisted.
Other limits:
- Only namespaced parameters can be set from a pod. Anything else belongs in the node's own configuration.
net.*is rejected outright when the pod uses host networking, whichadditionalPodSpec.hostNetworkturns on. There is no pod-level way to set a network parameter on a pod that shares the host's network namespace - it would be changing the node.
A cluster running Pod Security Admission at baseline or restricted forbids
unsafe parameters in a pod spec regardless of what the kubelet allows.
Interfaces the CGW creates itself
Per-interface parameters live under net.ipv4.conf.<interface>.*:
Chart-managed VTI mode and GRE create their interfaces after Kubernetes applies
sysctls. Use conf.default.* for these later interfaces; conf.all.* is
parameter-specific.
The chart-managed VTI path (ipsec.enabled: true,
ipsec.manualConfig: false, and ipsec.vti_key set) needs:
rather than naming the VTI. Manual IPsec configuration owns its interface setup
and sysctls. Writing /proc/sys after interface creation needs privileged: true; see Container privileges.
Other ways
Node configuration cannot enable Pod net.ipv4.ip_forward. Some IPv4
conf.{all,default}.* values may be inherited, depending on
net.core.devconf_inherit_init_net; configure the Pod explicitly instead.
The CNI tuning plugin can write namespace-wide sysctls after loopback.
For interface-specific keys, IFNAME names the attachment interface, not one
CGW creates later. CNI configuration, the NetworkAttachmentDefinition (NAD),
and Multus are cluster-owned:
IFNAME is replaced with the attachment interface name. Select the attachment
through the chart's passthrough annotation:
Limits:
IFNAMEcannot select CGW-createdvti*orgre-cgwinterfaces.- Namespace-wide and
conf.default.*settings affect the entire Pod namespace. - Validate the node-side allowlist and CNI chain against installed versions.
Troubleshooting
The Pod is SysctlForbidden. Allow the parameter through
--allowed-unsafe-sysctls or use another mechanism. The message
names only the first rejected parameter.
The Pod runs but does not forward. Check its namespace, not the node:
An annotation of the form
security.alpha.kubernetes.io/unsafe-sysctls: net.ipv6.conf.default.forwarding=1
uses Kubernetes' retired alpha interface. Move the entries to sysctls.
The value is right on eth0 but wrong on a tunnel. Use conf.default.*;
the tunnel was created later. See interfaces the CGW creates
itself.