Skip to content
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

Rename hostFirewall and mark stable #17221

Merged
merged 2 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Documentation/cmdref/cilium-agent.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 4 additions & 12 deletions Documentation/gettingstarted/host-firewall.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@

.. _host_firewall:

******************************************
Host Firewall (beta when using kube-proxy)
******************************************
*************
Host Firewall
*************

This document serves as an introduction to Cilium's host firewall, to enforce
security policies for Kubernetes nodes.

.. note::

The host firewall is a beta feature when running without our kube-proxy
replacement. In particular, two bugs need to be addressed before we can
consider this feature stable: :gh-issue:`12205` and :gh-issue:`14859`.
Please provide feedback and file a GitHub issue if you experience any
problems.

Enable the Host Firewall in Cilium
==================================

Expand All @@ -32,7 +24,7 @@ Deploy Cilium release via Helm:

helm install cilium |CHART_RELEASE| \\
--namespace kube-system \\
--set hostFirewall=true \\
--set hostFirewall.enabled=true \\
--set devices='{ethX,ethY}'

The ``devices`` flag refers to the network devices Cilium is configured on such
Expand Down
5 changes: 5 additions & 0 deletions Documentation/operations/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ New Options
acceptable kvstore consecutive quorum errors before the agent assumes
permanent failure.

Helm Options
~~~~~~~~~~~~

* ``hostFirewall`` was renamed to ``hostFirewall.enabled``.

.. _1.10_upgrade_notes:

1.10 Upgrade Notes
Expand Down
2 changes: 1 addition & 1 deletion Documentation/policy/language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ flags when installing Cilium:
* ``--set devices='{interface}'`` where ``interface`` refers to the
network device Cilium is configured on such as ``eth0``. Omitting this option
leads Cilium to auto-detect what interface the host firewall applies to.
* ``--set hostFirewall=true``
* ``--set hostFirewall.enabled=true``

The following policy will allow ingress traffic for any node with the label
``type=ingress-worker`` on TCP ports 22, 6443 (kube-apiserver), 2379 (etcd) and 4240
Expand Down
2 changes: 1 addition & 1 deletion daemon/cmd/daemon_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ func init() {
flags.Bool(option.EnableIdentityMark, true, "Enable setting identity mark for local traffic")
option.BindEnv(option.EnableIdentityMark)

flags.Bool(option.EnableHostFirewall, false, "Enable host network policies (beta when using kube-proxy)")
flags.Bool(option.EnableHostFirewall, false, "Enable host network policies")
option.BindEnv(option.EnableHostFirewall)

flags.String(option.NativeRoutingCIDR, "",
Expand Down
3 changes: 2 additions & 1 deletion install/kubernetes/cilium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ contributors across the globe, there is almost always someone available to help.
| gke.enabled | bool | `false` | Enable Google Kubernetes Engine integration |
| healthChecking | bool | `true` | Enable connectivity health checking. |
| healthPort | int | `9876` | TCP port for the agent health API. This is not the port for cilium-health. |
| hostFirewall | bool | `false` | Enables the enforcement of host policies in the eBPF datapath. |
| hostFirewall | object | `{"enabled":false}` | Configure the host firewall. |
| hostFirewall.enabled | bool | `false` | Enables the enforcement of host policies in the eBPF datapath. |
| hostPort.enabled | bool | `false` | Enable hostPort service support. |
| hostServices | object | `{"enabled":false,"protocols":"tcp,udp"}` | Configure ClusterIP service handling in the host namespace (the node). |
| hostServices.enabled | bool | `false` | Enable host reachable services. |
Expand Down
4 changes: 2 additions & 2 deletions install/kubernetes/cilium/templates/cilium-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ data:
enable-ipv4-fragment-tracking: "false"
{{- end }}

{{- if .Values.hostFirewall }}
enable-host-firewall: {{ .Values.hostFirewall | quote }}
{{- if and .Values.hostFirewall .Values.hostFirewall.enabled }}
enable-host-firewall: {{ .Values.hostFirewall.enabled | quote }}
{{- end}}

{{- if hasKey .Values "devices" }}
Expand Down
6 changes: 4 additions & 2 deletions install/kubernetes/cilium/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,10 @@ healthChecking: true
# -- TCP port for the agent health API. This is not the port for cilium-health.
healthPort: 9876

# -- Enables the enforcement of host policies in the eBPF datapath.
hostFirewall: false
# -- Configure the host firewall.
hostFirewall:
# -- Enables the enforcement of host policies in the eBPF datapath.
enabled: false

hostPort:
# -- Enable hostPort service support.
Expand Down
8 changes: 4 additions & 4 deletions test/helpers/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ var (
"gke.enabled": "true",
"loadBalancer.mode": "snat",
"nativeRoutingCIDR": GKENativeRoutingCIDR(),
"hostFirewall": "false",
"hostFirewall.enabled": "false",
"ipam.mode": "kubernetes",
"devices": "", // Override "eth0 eth0\neth0"
}
Expand All @@ -163,7 +163,7 @@ var (
}
kindHelmOverrides = map[string]string{
"ipv6.enabled": "false",
"hostFirewall": "false",
"hostFirewall.enabled": "false",
"nodeinit.enabled": "true",
"kubeProxyReplacement": "partial",
"externalIPs.enabled": "true",
Expand Down Expand Up @@ -2374,10 +2374,10 @@ func (kub *Kubectl) overwriteHelmOptions(options map[string]string) error {
}

if RunsWithHostFirewall() {
addIfNotOverwritten(options, "hostFirewall", "true")
addIfNotOverwritten(options, "hostFirewall.enabled", "true")
}

if RunsWithKubeProxyReplacement() || options["hostFirewall"] == "true" {
if RunsWithKubeProxyReplacement() || options["hostFirewall.enabled"] == "true" {
// Set devices
privateIface, err := kub.GetPrivateIface()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion test/k8sT/Conformance.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ = Describe("K8sConformance", func() {
// compatible with portmap chaining because traffic
// from pods to remote nodes goes through the tunnel.
// This issue is tracked at #12541.
"hostFirewall": "false",
"hostFirewall.enabled": "false",
}
ciliumFilename = helpers.TimestampFilename("cilium.yaml")
DeployCiliumOptionsAndDNS(kubectl, ciliumFilename, deployOpts)
Expand Down
22 changes: 11 additions & 11 deletions test/k8sT/DatapathConfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ var _ = Describe("K8sDatapathConfig", func() {
"bpf.monitorFlags": "syn",
// Need to disable the host firewall for now due to complexity issue.
// See #14552 for details.
"hostFirewall": "false",
"hostFirewall.enabled": "false",
}, DeployCiliumOptionsAndDNS)

monitorRes, monitorCancel, targetIP := monitorConnectivityAcrossNodes(kubectl)
Expand Down Expand Up @@ -706,7 +706,7 @@ var _ = Describe("K8sDatapathConfig", func() {
"encryption.enabled": "true",
"encryption.ipsec.interface": privateIface,
"devices": "",
"hostFirewall": "false",
"hostFirewall.enabled": "false",
"kubeProxyReplacement": "disabled",
}, DeployCiliumOptionsAndDNS)
Expect(testPodConnectivityAcrossNodes(kubectl)).Should(BeTrue(), "Connectivity test between nodes failed")
Expand All @@ -726,7 +726,7 @@ var _ = Describe("K8sDatapathConfig", func() {
"encryption.enabled": "true",
"encryption.ipsec.interface": privateIface,
"devices": devices,
"hostFirewall": "false",
"hostFirewall.enabled": "false",
"kubeProxyReplacement": "disabled",
}, DeployCiliumOptionsAndDNS)
Expect(testPodConnectivityAcrossNodes(kubectl)).Should(BeTrue(), "Connectivity test between nodes failed")
Expand Down Expand Up @@ -782,16 +782,16 @@ var _ = Describe("K8sDatapathConfig", func() {
return !helpers.IsIntegration(helpers.CIIntegrationGKE)
}, "Check connectivity with IPv6 disabled", func() {
deploymentManager.DeployCilium(map[string]string{
"ipv4.enabled": "true",
"ipv6.enabled": "false",
"hostFirewall": "true",
"ipv4.enabled": "true",
"ipv6.enabled": "false",
"hostFirewall.enabled": "true",
}, DeployCiliumOptionsAndDNS)
Expect(testPodConnectivityAcrossNodes(kubectl)).Should(BeTrue(), "Connectivity test between nodes failed")
})

It("With VXLAN", func() {
options := map[string]string{
"hostFirewall": "true",
"hostFirewall.enabled": "true",
}
if helpers.RunsOnGKE() {
options["gke.enabled"] = "false"
Expand All @@ -803,7 +803,7 @@ var _ = Describe("K8sDatapathConfig", func() {

It("With VXLAN and endpoint routes", func() {
options := map[string]string{
"hostFirewall": "true",
"hostFirewall.enabled": "true",
"endpointRoutes.enabled": "true",
}
if helpers.RunsOnGKE() {
Expand All @@ -816,8 +816,8 @@ var _ = Describe("K8sDatapathConfig", func() {

It("With native routing", func() {
options := map[string]string{
"hostFirewall": "true",
"tunnel": "disabled",
"hostFirewall.enabled": "true",
"tunnel": "disabled",
}
// We don't want to run with per-endpoint routes (enabled by
// gke.enabled) for this test.
Expand All @@ -832,7 +832,7 @@ var _ = Describe("K8sDatapathConfig", func() {

It("With native routing and endpoint routes", func() {
options := map[string]string{
"hostFirewall": "true",
"hostFirewall.enabled": "true",
"tunnel": "disabled",
"endpointRoutes.enabled": "true",
}
Expand Down
2 changes: 1 addition & 1 deletion test/k8sT/Policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ var _ = SkipDescribeIf(func() bool {
"masquerade": "false",
"bpf.masquerade": "false",

"hostFirewall": "true",
"hostFirewall.enabled": "true",
})

By("Retrieving backend pod and outside node IP addresses")
Expand Down
16 changes: 8 additions & 8 deletions test/k8sT/Services.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ Secondary Interface %s :: IPv4: (%s, %s), IPv6: (%s, %s)`, helpers.DualStackSupp

It("with the host firewall and externalTrafficPolicy=Local", func() {
DeployCiliumOptionsAndDNS(kubectl, ciliumFilename, map[string]string{
"hostFirewall": "true",
"hostFirewall.enabled": "true",
})
testExternalTrafficPolicyLocal(kubectl, ni)
})
Expand Down Expand Up @@ -872,7 +872,7 @@ Secondary Interface %s :: IPv4: (%s, %s), IPv6: (%s, %s)`, helpers.DualStackSupp

BeforeAll(func() {
DeployCiliumOptionsAndDNS(kubectl, ciliumFilename, map[string]string{
"hostFirewall": "true",
"hostFirewall.enabled": "true",
})

ccnpHostPolicy = helpers.ManifestGet(kubectl.BasePath(), "ccnp-host-policy-nodeport-tests.yaml")
Expand Down Expand Up @@ -917,7 +917,7 @@ Secondary Interface %s :: IPv4: (%s, %s), IPv6: (%s, %s)`, helpers.DualStackSupp
"maglev.tableSize": "251",
// Support for host firewall + Maglev is currently broken,
// see #14047 for details.
"hostFirewall": "false",
"hostFirewall.enabled": "false",
})

echoYAML = helpers.ManifestGet(kubectl.BasePath(), "echo-svc.yaml")
Expand Down Expand Up @@ -1020,7 +1020,7 @@ Secondary Interface %s :: IPv4: (%s, %s), IPv6: (%s, %s)`, helpers.DualStackSupp
DeployCiliumOptionsAndDNS(kubectl, ciliumFilename, map[string]string{
"tunnel": "disabled",
"autoDirectNodeRoutes": "true",
"hostFirewall": "true",
"hostFirewall.enabled": "true",
})

ccnpHostPolicy = helpers.ManifestGet(kubectl.BasePath(), "ccnp-host-policy-nodeport-tests.yaml")
Expand Down Expand Up @@ -1070,7 +1070,7 @@ Secondary Interface %s :: IPv4: (%s, %s), IPv6: (%s, %s)`, helpers.DualStackSupp
"maglev.tableSize": "251",
// Support for host firewall + Maglev is currently broken,
// see #14047 for details.
"hostFirewall": "false",
"hostFirewall.enabled": "false",
})

echoYAML = helpers.ManifestGet(kubectl.BasePath(), "echo-svc.yaml")
Expand Down Expand Up @@ -1392,7 +1392,7 @@ Secondary Interface %s :: IPv4: (%s, %s), IPv6: (%s, %s)`, helpers.DualStackSupp
"devices": fmt.Sprintf(`'{%s}'`, ni.privateIface),
// Support for host firewall + Maglev is currently broken,
// see #14047 for details.
"hostFirewall": "false",
"hostFirewall.enabled": "false",
})
testNodePortExternal(kubectl, ni, false, false)
})
Expand Down Expand Up @@ -1420,7 +1420,7 @@ Secondary Interface %s :: IPv4: (%s, %s), IPv6: (%s, %s)`, helpers.DualStackSupp
"devices": fmt.Sprintf(`'{%s}'`, ni.privateIface),
// Support for host firewall + Maglev is currently broken,
// see #14047 for details.
"hostFirewall": "false",
"hostFirewall.enabled": "false",
})
testNodePortExternal(kubectl, ni, true, false)
})
Expand Down Expand Up @@ -1448,7 +1448,7 @@ Secondary Interface %s :: IPv4: (%s, %s), IPv6: (%s, %s)`, helpers.DualStackSupp
"devices": fmt.Sprintf(`'{%s}'`, ni.privateIface),
// Support for host firewall + Maglev is currently broken,
// see #14047 for details.
"hostFirewall": "false",
"hostFirewall.enabled": "false",
})
testNodePortExternal(kubectl, ni, true, true)
})
Expand Down