security(k8s): enforce Pod Security Standards (Restricted) on all namespaces#196
Open
adesuwa-tech wants to merge 1 commit into
Open
security(k8s): enforce Pod Security Standards (Restricted) on all namespaces#196adesuwa-tech wants to merge 1 commit into
adesuwa-tech wants to merge 1 commit into
Conversation
Closes VertexChainLabs#177 Add pod-security.kubernetes.io labels to vertexchain-dev, vertexchain-staging, and vertexchain-prod namespaces: enforce: restricted — admission controller rejects any pod spec that violates the Restricted policy audit: restricted — violations recorded in the audit log warn: restricted — user-facing warning on kubectl apply All three modes pin to enforce-version/audit-version/warn-version: latest so the policy tracks the cluster's current Kubernetes version without requiring manual version bumps. With enforce: restricted the following pod spec properties are blocked at admission time: - privileged containers - hostNetwork / hostPID / hostIPC - hostPath volumes - privilege escalation (allowPrivilegeEscalation: true) - running as root (runAsNonRoot must be true) - unsafe capabilities (only NET_BIND_SERVICE permitted) - seccompProfile must be RuntimeDefault or Localhost
Contributor
|
Two CI flags: 1) the Conventional Commits lint is rejecting the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #177
Applies Kubernetes built-in Pod Security Standards (PSS) at the
restrictedlevel to all three application namespaces by addingpod-security.kubernetes.io/*labels toinfrastructure/k8s/namespaces.yaml.No external admission controller (OPA/Gatekeeper, Kyverno) is required — PSS is implemented natively by the Kubernetes API server since v1.25 (stable).
Changes
File modified:
infrastructure/k8s/namespaces.yamlAdded the following labels to
vertexchain-dev,vertexchain-staging, andvertexchain-prod:enforceauditwarnkubectl apply(non-blocking)What the Restricted policy blocks
hostNetwork/hostPID/hostIPChostPathvolumesallowPrivilegeEscalation: truerunAsNonRootmust betrue)NET_BIND_SERVICEpermitted)seccompProfilemust beRuntimeDefaultorLocalhostAcceptance Criteria
vertexchain-devlabeledenforce: restrictedvertexchain-staginglabeledenforce: restrictedvertexchain-prodlabeledenforce: restrictedaudit+warnmodes also set (defence-in-depth for observability)privileged: true) will be rejected at admission — verified by PSS spec behaviourenforce-version: latestensures the policy tracks the cluster's current k8s version automaticallyHow to verify after merge
Checklist
Closes #177)kubectlcommand above)