Giter Club home page Giter Club logo

psp's Introduction

What is PodSecurityPolicy(PSP) ?

A PodSecurityPolicy (PSP) is cluster level resource that controls security sensitive aspects of the Pod specefications via Kubernetes Admission Control.

How to enable PodSecurityPolicy (PSP) into the Cluster?

  • Set of policies (At least 2. A permisive policy for Kube-System namespace and restrictive policy for rest of the workload running in the cluster)
  • RBAC for PSP Policies. (The policies are notthing but a Kubernetes object. In order to something in Kubernetes to use these policies, we have to create associated Role-base access control (RBAC))
  • Last but not least, Activate the PodSecurityPolicy via admission control flag in Kube-Api Server (--enable-admission-plugins=PodSecurityPolicy). I purposely mentiond this last to stress the point, only enabling the PSP in Kube-API server and not having policy and assocated RBAC will make cluster non-operational.

What are the steps to bring up the cluster along with PSP?

  • Start the KIND Cluster. Check the kind-config.yaml. The PSP flag is enabled in the Kube-API Server
    kind create cluster --config=kind-config.yaml
    
  • Apply the restricted policy along with RBAC
    kubectl apply -f restricted-psp.yaml
    kubectl apply -f restricted-rbac.yaml
    
  • Apply the priviledge policy along with RBAC
    kubectl apply -f privileged-psp.yaml
    kubectl apply -f privileged-rbac.yaml
    
  • make sure all critical Pods are up and running
    kubectl get pods -A
    kubectl get nodes
    

We have PSP configured. Now lets discuss about the verious Control Aspects (#16) for pod specefications

seccomp a.k.a Secure Compute Mode Profile

Secure compute (seccomp) model is feature, which focuses on limiting what system calls our containers will be able to execute

I have created a custome seccomp profile, which restrict to run ls command inside a continer. I have tested the same by running :

docker container run --rm -it --security-opt seccomp=default-no-ls.json alpine sh
/ # ls
sh: lseek: Operation not permitted

Now, I am trying activate the same profile in Kubernetes.

I have created configMap for the seccomp profile.

I placed th profile inside the node /var/lib/kubelet/seccomp(using a daemonset)

and then created a deployment with following annotations: container.security.alpha.kubernetes.io/alpine: "localhost/my-profile.json"

psp's People

Contributors

jsarkar avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.