Open nathanweeks opened 6 months ago
Action required from @Azure/aks-pm
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Describe the bug The fluxconfig-agent controller uses a hostPath volume mount that attempts to access a
/var/lib/docker/containers
directory on the host. When the Kubernetes cluster pod hostPath volumes should only use allowed host paths policy is enforced (e.g., as part of the Kubernetes cluster pod security baseline standards for Linux-based workloads policy initiative) with "deny" effect, the fluxconfig-agent fails to start due to policy violation.This hostPath volume mount seems to be cruft in fluxconfig-agent, since docker is no longer used as the container runtime for AKS.
To Reproduce
set -o errexit
readonly RESOURCE_GROUP=aks-rg readonly CLUSTER_NAME=aks-demo
az group create --resource-group ${RESOURCE_GROUP}
az policy assignment create \ --resource-group ${RESOURCE_GROUP} \ --policy '098fc59e-46c7-4d99-9b16-64990e543d75' \ --param '{"effect": { "value": "deny" }}'
az aks create \ -n ${CLUSTER_NAME} \ -g ${RESOURCE_GROUP} \ --node-vm-size Standard_B2s \ --node-osdisk-size 30 \ --node-count 1 \ --enable-addons azure-policy \ --tier free
az k8s-configuration flux create \ -g ${RESOURCE_GROUP} \ -c ${CLUSTER_NAME} \ -n cluster-config \ --namespace cluster-config \ -t managedClusters \ --scope cluster \ -u https://github.com/Azure/gitops-flux2-kustomize-helm-mt \ --branch main \ --kustomization name=infra path=./infrastructure prune=true
$ az aks get-credentials -g aks-rg -n aks-demo ... $ kubectl -n flux-system get rs NAME DESIRED CURRENT READY AGE fluxconfig-agent-f594b6fdb 1 0 0 11m ... $ kubectl -n flux-system events rs/fluxconfig-agent-f594b6fdb ... 76s (x9 over 12m) Warning FailedCreate ReplicaSet/fluxconfig-agent-f594b6fdb (combined from similar events): Error creating: admission webhook "validation.gatekeeper.sh" denied the request: [azurepolicy-k8sazurev3hostfilesystem-5f58ca0751a242787f0c] HostPath volume {"hostPath": {"path": "/var/lib/docker/containers", "type": ""}, "name": "varlibdockercontainers"} is not allowed, pod: fluxconfig-agent-f594b6fdb-hxbdb. Allowed path: []