• Stars
    star
    154
  • Rank 242,095 (Top 5 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kubernetes Admission Webhook for LXCFS

This project shows how to build and deploy an AdmissionWebhook for LXCFS.

Prerequisites

Kubernetes 1.9.0 or above with the admissionregistration.k8s.io/v1beta1 API enabled. Verify that by the following command:

kubectl api-versions | grep admissionregistration.k8s.io/v1beta1

The result should be:

admissionregistration.k8s.io/v1beta1

In addition, the MutatingAdmissionWebhook and ValidatingAdmissionWebhook admission controllers should be added and listed in the correct order in the admission-control flag of kube-apiserver.

Build

  1. Setup dep

    The repo uses dep as the dependency management tool for its Go codebase. Install dep by the following command:

go get -u github.com/golang/dep/cmd/dep
  1. Build and push docker image
./build

Deploy

  1. Deploy lxcfs to worker nodes
kubectl apply -f deployment/lxcfs-daemonset.yaml
  1. Install injector with lxcfs-admission-webhook
deployment/install.sh

Test

  1. Enable the namespace for injection
kubectl label namespace default lxcfs-admission-webhook=enabled

Note: All the new created pod under the namespace will be injected with LXCFS

  1. Deploy the test deployment
kubectl apply -f deployment/web.yaml
  1. Inspect the resource inside container
$ kubectl get pod

NAME                                                 READY   STATUS    RESTARTS   AGE
lxcfs-admission-webhook-deployment-f4bdd6f66-5wrlg   1/1     Running   0          8m29s
lxcfs-pqs2d                                          1/1     Running   0          55m
lxcfs-zfh99                                          1/1     Running   0          55m
web-7c5464f6b9-6zxdf                                 1/1     Running   0          8m10s
web-7c5464f6b9-nktff                                 1/1     Running   0          8m10s

$ kubectl exec -ti web-7c5464f6b9-6zxdf sh
# free
             total       used       free     shared    buffers     cached
Mem:        262144       2744     259400          0          0        312
-/+ buffers/cache:       2432     259712
Swap:            0          0          0
#

Cleanup

  1. Uninstall injector with lxcfs-admission-webhook
deployment/uninstall.sh
  1. Uninstall lxcfs from cluster nodes
kubectl delete -f deployment/lxcfs-daemonset.yaml

How does it work?

If you want to know webhooks in depth, please check it out!

More Repositories

1

aliyungo

Go SDK for Aliyun (Alibaba Cloud) - Golang API for ECS, OSS, DNS, SLB, RDS, RAM, MNS, STS, SLS, MQ, Push, OpenSearch, DM, Container Service etc.
Go
843
star
2

slides-downloader

Download slides for KubeCon, etc.
Shell
84
star
3

lxcfs-initializer

Kubernetes Initializer example to support LXCFS - https://yq.aliyun.com/articles/566208
Go
51
star
4

face_recognition_pi

Face Recognition Docker Images for Raspberry Pi - https://yq.aliyun.com/articles/346459
Python
37
star
5

wasm-container-samples

C
30
star
6

docker-tomcat-autoheap

Docker Image for Tomcat which sets heap size automatically
Shell
29
star
7

docker-storm

Apache Storm in Docker
Shell
24
star
8

docker-selenium

Docker image for Selenium
Shell
21
star
9

docker-swarm-mode-vagrant

Vagrant for Docker swarm mode introduced from 1.12
Shell
21
star
10

tensorflow-docker

Jupyter Notebook
15
star
11

system-info

This is sample project to display the CPU/Memory resources for JVM of Tomcat - https://yq.aliyun.com/articles/562440
Java
12
star
12

google-containers

Shell
11
star
13

docker-serverless-sample

A simple sample for using Docker for Serverless style application in Aliyun Container Service
Python
9
star
14

docker-swarm-vagrant

This project is deprecated. Please check https://github.com/denverdino/docker-swarm-mode-vagrant for the new project for Docker Swarm Mode
Shell
8
star
15

docker-sync-repo

Synchronize repos from Docker Hub to local registry
Python
8
star
16

knative-wagi

Dockerfile
7
star
17

docker-spring-boot-sample-session-redis

Docker Sample for Spring Boot application with Redis session store
Java
7
star
18

aliyun-mock-metadata

Mock Alibaba Cloud ECS instance metadata service that can run on a developer machine
Go
5
star
19

ossfs-image

Docker Image for OSSFS based on Alpine Linux
Dockerfile
5
star
20

aliyun-docker

Docker images for Aliyun
5
star
21

docker-registry-console

JavaScript
5
star
22

trace-runner-for-docker-desktop

Dockerfile
4
star
23

distribution-experiment

Go
3
star
24

ask-action-demo

HTML
2
star
25

langchain-test

Python
2
star
26

actions-test

Dockerfile
2
star
27

BaiduLocationPlugin

Java
2
star
28

machine-1

Go
1
star
29

hello-github-actions

Dockerfile
1
star
30

distribution-fuse

Go
1
star
31

act-base

Base image for local development for Github Actions
Dockerfile
1
star
32

replaceFonts

Replace fonts in PPT
VBA
1
star
33

chatgpt-sample

CSS
1
star
34

qperf-docker

Docker Image of qperf
1
star
35

secure-supply-chain-sample

Go
1
star
36

pod-validatingwebhook

Makefile
1
star
37

swarm-1

Go
1
star