Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Security Context #181

Closed
rgherta opened this issue Apr 5, 2022 · 3 comments · Fixed by #187
Closed

Security Context #181

rgherta opened this issue Apr 5, 2022 · 3 comments · Fixed by #187

Comments

@rgherta
Copy link
Contributor

rgherta commented Apr 5, 2022

Successfuly tested restricted namespace enforcing v1.23 and pod security standards

apiVersion: v1
kind: Namespace
metadata:
  labels:
    control-plane: controller-manager
    pod-security.kubernetes.io/enforce: restricted  
    pod-security.kubernetes.io/enforce-version: v1.23
  name: hnc-system

Also security context for controller-manager

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    control-plane: controller-manager
  name: hnc-controller-manager
  namespace: hnc-system
spec:
  replicas: 1
  selector:
    matchLabels:
      control-plane: controller-manager
  template:
    metadata:
      annotations:
        prometheus.io/scrape: "true"
      labels:
        control-plane: controller-manager
    spec:
      containers:
      - args:
        - --webhook-server-port=9443
        - --metrics-addr=:8080
        - --max-reconciles=10
        - --apiserver-qps-throttle=50
        - --excluded-namespace=kube-system
        - --excluded-namespace=kube-public
        - --excluded-namespace=hnc-system
        - --excluded-namespace=kube-node-lease
        - --excluded-namespace=openebs
        - --excluded-namespace=default
        - --excluded-namespace=gitlab-kubernetes-agent
        - --excluded-namespace=cilium-monitoring
        - --enable-internal-cert-management
        - --cert-restart-on-secret-refresh
        command:
        - /manager
        image: gcr.io/k8s-staging-multitenancy/hnc-manager:v1.0.0
        livenessProbe:
          failureThreshold: 1
          httpGet:
            path: /healthz
            port: 8081
          periodSeconds: 10
        name: manager
        ports:
        - containerPort: 9443
          name: webhook-server
          protocol: TCP
        - containerPort: 8080
          name: metrics
          protocol: TCP
...
        securityContext:
          allowPrivilegeEscalation: false
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          seccompProfile:
            type: RuntimeDefault
          capabilities:
            drop: ["ALL"]

...
...

@rgherta rgherta changed the title Pod Security Standards Security Context Apr 5, 2022
@adrianludwin
Copy link
Contributor

adrianludwin commented Apr 5, 2022 via email

@rgherta
Copy link
Contributor Author

rgherta commented Apr 5, 2022

I think it can wait for the next release. I will create the pull request of course.

@adrianludwin
Copy link
Contributor

adrianludwin commented Apr 5, 2022 via email

This was referenced Apr 5, 2022
rgherta added a commit to rgherta/hierarchical-namespaces that referenced this issue Apr 5, 2022
Fixes kubernetes-retired#181
Tested:
ok      sigs.k8s.io/hierarchical-namespaces/internal/anchor     0.026s  coverage: 14.9% of statements
ok      sigs.k8s.io/hierarchical-namespaces/internal/config     0.049s  coverage: 18.8% of statements
ok      sigs.k8s.io/hierarchical-namespaces/internal/forest     0.043s  coverage: 25.1% of statements
ok      sigs.k8s.io/hierarchical-namespaces/internal/hierarchyconfig    0.099s  coverage: 23.8% of statements
ok      sigs.k8s.io/hierarchical-namespaces/internal/hncconfig  0.023s  coverage: 25.7% of statements
ok      sigs.k8s.io/hierarchical-namespaces/internal/namespace  0.020s  coverage: 59.8% of statements
ok      sigs.k8s.io/hierarchical-namespaces/internal/objects    0.018s  coverage: 35.3% of statements
ok      sigs.k8s.io/hierarchical-namespaces/test/e2e    0.002s
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants