Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
f09f8664
Commit
f09f8664
authored
Feb 08, 2018
by
Cao Shufeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix README for admission webhook test image
This README is copied from somewhere else and it's out of date.
parent
7b678dc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
37 deletions
+5
-37
README.md
test/images/webhook/README.md
+5
-37
No files found.
test/images/webhook/README.md
View file @
f09f8664
# Kubernetes External Admission Webhook
Exampl
e
# Kubernetes External Admission Webhook
Test Imag
e
The example shows how to build and deploy an external webhook that only admits
pods creation and update if the container images have the "grc.io" prefix.
The image tests MutatingAdmissionWebhook and ValidatingAdmissionWebhook. After deploying
it to kubernetes cluster, administrator needs to create a ValidatingWebhookConfiguration
in kubernetes cluster to register remote webhook admission controllers.
## Prerequisites
Please use a Kubernetes release at least as new as v1.8.0 or v1.9.0-alpha.1,
because the generated server cert/key only works with Kubernetes release that
contains this
[
change
](
https://github.com/kubernetes/kubernetes/pull/50476
)
.
Please checkout the
`pre-v1.8`
tag for an example that works with older
clusters.
Please enable the admission webhook feature
(
[
doc
](
https://kubernetes.io/docs/admin/extensible-admission-controllers/#enable-external-admission-webhooks
)
).
TODO: add the reference when the document for admission webhook v1beta1 API is done.
## Build the code
```
bash
make build
```
The Makefile assumes your cluster is created by the
[
hack/local-up-cluster.sh
](
https://github.com/kubernetes/kubernetes/blob/master/hack/local-up-cluster.sh
)
.
Please modify the Makefile accordingly if your cluster is created differently.
## Explanation on the CAs/Certs/Keys
The apiserver initiates a tls connection with the webhook, so the apiserver is
the tls client, and the webhook is the tls server.
The webhook proves its identity by the
`serverCert`
in the certs.go. The server
cert is signed by the CA in certs.go. To let the apiserver trust the
`caCert`
,
the webhook registers itself with the apiserver via the
`admissionregistration/v1beta1/externalAdmissionHook`
API, with
`clientConfig.caBundle=caCert`
.
For maximum protection, this example webhook requires and verifies the client
(i.e., the apiserver in this case) cert. The cert presented by the apiserver is
signed by a client CA, whose cert is stored in the configmap
`extension-apiserver-authentication`
in the
`kube-system`
namespace. See the
`getAPIServerCert`
function for more information. Usually you don't need to
worry about setting up this CA cert. It's taken care of when the cluster is
created. You can disable the client cert verification by setting the
`tls.Config.ClientAuth`
to
`tls.NoClientCert`
in
`config.go`
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment