Terraform k8s deployments - Handle runAsUser/runAsGroup/run_as_non_root when not defined for (#53)

Handling use-case where kubernetes platform is openshift and
runAsUser/runAsGroup is not defined by a user; Openshift automatically
assigns runAsUser/runAsGroup.
This commit is contained in:
Jorge Falcon authored and GitHub committed 2025-05-30 10:05:42 -04:00
1 parent 770afe9cd3
commit 2b8b75199a
6 files changed
+52 -18

No files matched your search

+34 -1
View File
@@ -1,5 +1,5 @@
module "fleet" {
source = "git::https://github.com/fleetdm/fleet-terraform//k8s?depth=1&ref=tf-mod-k8s-v1.1.0"
source = "git::https://github.com/fleetdm/fleet-terraform//k8s?depth=1&ref=tf-mod-k8s-v1.1.1"
namespace = "fleet"
hostname = "fleet.localhost.local"
@@ -196,9 +196,42 @@ module "fleet" {
}
extra_volumes = []
extra_volume_mounts = []
/*
If you're not providing an id for run_as_user or run_as_group,
and you're not running on Openshift (Openshift will set the userid/groupid, if left blank),
you might encounter an issue with Fleet pods starting up, where
k8s is not able to determine whether the fleet user, in the
Fleet container image, is running as root.
Examples:
1. Openshift example (without id's):
security_context = {
run_as_non_root = true
}
2. Openshift example (with id's):
security_context = {
run_as_user = 1000653333
run_as_group = 1000653333
run_as_non_root = true
}
3. Non-Openshift (without id's):
security_context = {
run_as_non_root = false
}
4. Non-Openshift (with id's):
security_context = {
run_as_user = 3333
run_as_group = 3333
run_as_non_root = true
}
*/
security_context = {
run_as_user = 3333
run_as_group = 3333
run_as_non_root = true
}
}