This repository was archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 558
Add Enable Pod Security Option #2048
Merged
jackfrancis
merged 2 commits into
Azure:master
from
DigitalInnovation:podSecurityPolicy
Jan 18, 2018
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
128 changes: 128 additions & 0 deletions
128
parts/k8s/manifests/kubernetesmaster-pod-security-policy.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: PodSecurityPolicy | ||
metadata: | ||
name: privileged | ||
annotations: | ||
seccomp.security.alpha.kubernetes.io/allowedProfileNames: "*" | ||
spec: | ||
privileged: true | ||
allowPrivilegeEscalation: true | ||
allowedCapabilities: | ||
- "*" | ||
volumes: | ||
- "*" | ||
hostNetwork: true | ||
hostPorts: | ||
- min: 0 | ||
max: 65535 | ||
hostIPC: true | ||
hostPID: true | ||
runAsUser: | ||
rule: 'RunAsAny' | ||
seLinux: | ||
rule: 'RunAsAny' | ||
supplementalGroups: | ||
rule: 'RunAsAny' | ||
fsGroup: | ||
rule: 'RunAsAny' | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: PodSecurityPolicy | ||
metadata: | ||
name: restricted | ||
annotations: | ||
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default' | ||
apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default' | ||
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default' | ||
apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default' | ||
spec: | ||
privileged: false | ||
# Required to prevent escalations to root. | ||
allowPrivilegeEscalation: false | ||
# This is redundant with non-root + disallow privilege escalation, | ||
# but we can provide it for defense in depth. | ||
requiredDropCapabilities: | ||
- ALL | ||
# Allow core volume types. | ||
volumes: | ||
- 'configMap' | ||
- 'emptyDir' | ||
- 'projected' | ||
- 'secret' | ||
- 'downwardAPI' | ||
# Assume that persistentVolumes set up by the cluster admin are safe to use. | ||
- 'persistentVolumeClaim' | ||
hostNetwork: false | ||
hostIPC: false | ||
hostPID: false | ||
runAsUser: | ||
# Require the container to run without root privileges. | ||
rule: 'MustRunAsNonRoot' | ||
seLinux: | ||
# This policy assumes the nodes are using AppArmor rather than SELinux. | ||
rule: 'RunAsAny' | ||
supplementalGroups: | ||
rule: 'MustRunAs' | ||
ranges: | ||
# Forbid adding the root group. | ||
- min: 1 | ||
max: 65535 | ||
fsGroup: | ||
rule: 'MustRunAs' | ||
ranges: | ||
# Forbid adding the root group. | ||
- min: 1 | ||
max: 65535 | ||
readOnlyRootFilesystem: false | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: psp:privileged | ||
rules: | ||
- apiGroups: ['extensions'] | ||
resources: ['podsecuritypolicies'] | ||
verbs: ['use'] | ||
resourceNames: | ||
- privileged | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: psp:restricted | ||
rules: | ||
- apiGroups: ['extensions'] | ||
resources: ['podsecuritypolicies'] | ||
verbs: ['use'] | ||
resourceNames: | ||
- restricted | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: default:restricted | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: psp:restricted | ||
subjects: | ||
- kind: Group | ||
name: system:authenticated | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: default:privileged | ||
namespace: kube-system | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: psp:privileged | ||
subjects: | ||
- kind: Group | ||
name: system:masters | ||
apiGroup: rbac.authorization.k8s.io | ||
- kind: Group | ||
name: system:serviceaccounts:kube-system | ||
apiGroup: rbac.authorization.k8s.io |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be removed since it is controlled by RBAC at the botton of this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it as the following:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern is that it changes the default behavior of "--use-service-account-credentials", it used to be false when RBAC is off, but now it becomes true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pidah Can you explain the use-case where a cluster would want
--use-service-account-credentials
without RBAC enabled? In other words, what is the justification for disentangling this controller-manager runtime option from higher order acs-engine RBAC enforcement?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackfrancis @JunSun17 No strong opinion – as I understand it, the
--use-service-account-credentials
flag ensures the kubernetes controller manager uses the individual designated service accounts for each control loop instead of a single service account credential for all control loops. This segregation/subdivision seemed like a good default and shouldn't impact the cluster when RBAC is not enabled.