Skip to content

Commit

Permalink
Merge pull request #1305 from DjVinnii/hubble
Browse files Browse the repository at this point in the history
feat: Add option to enable Hubble
  • Loading branch information
mysticaltech authored Mar 31, 2024
2 parents 7a269fd + 2607dc3 commit d1ba708
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,15 @@ _You can also use it in an automated flow, in which case `create_kubeconfig` sho
The default is Flannel, but you can also choose Calico or Cilium, by setting the `cni_plugin` variable in `kube.tf` to "calico" or "cilium".
### Cilium
As Cilium has a lot of interesting and powerful config possibilities, we give you the ability to configure Cilium with the helm `cilium_values` variable (see the cilium specific [helm values](https://github.com/cilium/cilium/blob/master/install/kubernetes/cilium/values.yaml)) before you deploy your cluster.
Cilium supports full kube-proxy replacement. Cilium runs by default in hybrid kube-proxy replacement mode. To achieve a completely kube-proxy-free cluster, set `disable_kube_proxy = true`.
It is also possible to enable Hubble using `cilium_hubble_enabled = true`. In order to access the Hubble UI, you need to port-forward the Hubble UI service to your local machine. By default, you can do this by running `kubectl port-forward -n kube-system service/hubble-ui 12000:80` and then opening `http://localhost:12000` in your browser.
However, it is recommended to use the [Cilium CLI](https://docs.cilium.io/en/stable/gettingstarted/k8s-install-default/#install-the-cilium-cli) and [Hubble Client](https://docs.cilium.io/en/stable/gettingstarted/k8s-install-default/#install-the-cilium-cli) and running the `cilium hubble ui` command.
## Scaling Nodes
Two things can be scaled: the number of nodepools or the number of nodes in these nodepools.
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
| <a name="input_calico_version"></a> [calico\_version](#input\_calico\_version) | Version of Calico. | `string` | `null` | no |
| <a name="input_cert_manager_values"></a> [cert\_manager\_values](#input\_cert\_manager\_values) | Additional helm values file to pass to Cert-Manager as 'valuesContent' at the HelmChart. | `string` | `""` | no |
| <a name="input_cilium_egress_gateway_enabled"></a> [cilium\_egress\_gateway\_enabled](#input\_cilium\_egress\_gateway\_enabled) | Enables egress gateway to redirect and SNAT the traffic that leaves the cluster. | `bool` | `false` | no |
| <a name="input_cilium_hubble_enabled"></a> [cilium\_hubble\_enabled](#input\_cilium\_hubble\_enabled) | Enables Hubble Observability to collect and visualize network traffic. | `bool` | `false` | no |
| <a name="input_cilium_ipv4_native_routing_cidr"></a> [cilium\_ipv4\_native\_routing\_cidr](#input\_cilium\_ipv4\_native\_routing\_cidr) | Used when Cilium is configured in native routing mode. The CNI assumes that the underlying network stack will forward packets to this destination without the need to apply SNAT. Default: value of "cluster\_ipv4\_cidr" | `string` | `null` | no |
| <a name="input_cilium_routing_mode"></a> [cilium\_routing\_mode](#input\_cilium\_routing\_mode) | Set native-routing mode ("native") or tunneling mode ("tunnel"). | `string` | `"tunnel"` | no |
| <a name="input_cilium_values"></a> [cilium\_values](#input\_cilium\_values) | Additional helm values file to pass to Cilium as 'valuesContent' at the HelmChart. | `string` | `""` | no |
Expand Down
7 changes: 5 additions & 2 deletions kube.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ module "kube-hetzner" {
# For maximum security, it's best to disable it completely by setting it to null. However, in that case, to get access to the kube api,
# you would have to connect to any control plane node via SSH, as you can run kubectl from within these.
# Please be advised that this setting has no effect on the load balancer when the use_control_plane_lb variable is set to true. This is
# because firewall rules cannot be applied to load balancers yet.
# because firewall rules cannot be applied to load balancers yet.
# firewall_kube_api_source = null

# Allow SSH access from the specified networks. Default: ["0.0.0.0/0", "::/0"]
Expand Down Expand Up @@ -680,6 +680,9 @@ module "kube-hetzner" {
# Enables egress gateway to redirect and SNAT the traffic that leaves the cluster. Default: false
# cilium_egress_gateway_enabled = true

# Enables Hubble Observability to collect and visualize network traffic. Default: false
# cilium_hubble_enabled = true

# You can choose the version of Calico that you want. By default, the latest is used.
# More info on available versions can be found at https://github.com/projectcalico/calico/releases
# Please note that if you are getting 403s from Github, it's also useful to set the version manually. However there is rarely a need for that!
Expand All @@ -690,7 +693,7 @@ module "kube-hetzner" {
# disable_kube_proxy = true

# If you want to disable the k3s default network policy controller, use this flag!
# Both Calico and Ciliun cni_plugin values override this value to true automatically, the default is "false".
# Both Calico and Cilium cni_plugin values override this value to true automatically, the default is "false".
# disable_network_policy = true

# If you want to disable the automatic use of placement group "spread". See https://docs.hetzner.com/cloud/placement-groups/overview/
Expand Down
8 changes: 8 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,14 @@ egressGateway:
enabled: true
%{endif~}
%{if var.cilium_hubble_enabled}
hubble:
relay:
enabled: true
ui:
enabled: true
%{endif~}
MTU: 1450
EOT

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,12 @@ variable "cilium_egress_gateway_enabled" {
description = "Enables egress gateway to redirect and SNAT the traffic that leaves the cluster."
}

variable "cilium_hubble_enabled" {
type = bool
default = false
description = "Enables Hubble Observability to collect and visualize network traffic."
}

variable "cilium_ipv4_native_routing_cidr" {
type = string
default = null
Expand Down

0 comments on commit d1ba708

Please sign in to comment.