Skip to content

fengpinghu/admissionctl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes admission control

readme

This project uses AdmissionWebhooks to control kubernetes objects, such as setting securitycontext of containers, labeling pods with Usernames, setting up walltime, validating user rights on kubernetes objects and etc. Together with RBAC, this admission control webhook enables an on prem kubernetes cluster to be shared by users such that host file systems can be controlled and accessed based on user rights, users won't step on each other's toes and many other possiblities......

Notes

Currently the supported kubernetes resource includes: the native pods, jobs, deployment, as well as the volcano vcjob

Build and Deploy

Make sure to build with cgo enabled. Make sure user information is available on the admission control container. For example configure it with sssd support. For other details, please refer to plumbing for admission webhooks

Verify

  1. run a container as the submitting user.

Submitting user has this in the jwt

{
  ... 
  "groups": [
    "group1",
    "group2"
  ],
  "name": "user1"
}

Run busybox and check user id

$ kubectl run test -n kube-public --image=busybox -it --rm --restart=Never /bin/sh
If you don't see a command prompt, try pressing enter.
/ $ id
uid=xxx gid=xxx(users) groups=xxx,xxx

The uid will match what user1 has on the target system.

  1. delete other peoples resource:
$ kubectl delete pod -n kube-public apple-app
Error from server (You are not allowed to delete this resource, please contact admin if you have any questions!)

Troubleshooting

  1. Check if the user is available on the webhook container.
  2. Check if the user is available on the host system

About

k8s admission control

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published