Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Deploy on Kubernetes #2

Closed
wants to merge 4 commits into from
Closed

Conversation

SimonBarendse
Copy link
Member

This continues on the work of #1 and makes it possible to deploy the webhook on the Kubernetes cluster itself instead of to a cloud function.

Comment on lines +30 to +34
- name: SECRETHUB_CREDENTIAL
valueFrom:
secretKeyRef:
name: secrethub-mutating-webhook
key: secrethub_credential
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be replaced with native authentication in the case of AWS EKS and soon also with native authentication on GKE.

name: secrethub-mutating-webhook
namespace: default
path: "/"
caBundle: "${CA_BUNDLE}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be replaced with the CA bundle of your cluster, which can be obtained with kubectl config view --raw --minify --flatten -o jsonpath='{.clusters[].cluster.certificate-authority-data}'

spec:
containers:
- name: secrethub-mutating-webhook
image: simonbarendse/kubernetes-mutating-webhook:latest
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the image resulting from the Dockerfile in this repo. If we agree with the current state, let's push that to the secrethub org on DockerHub:

Suggested change
image: simonbarendse/kubernetes-mutating-webhook:latest
image: secrethub/kubernetes-mutating-webhook:latest

- /bin/sh
- -c
args:
- "secrethub read kubernetes-webhook/webhook/cert.pem -o /webhook-certs/cert.pem && secrethub read kubernetes-webhook/webhook/key.pem -o /webhook-certs/key.pem"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can other people deploy this if it uses kubernetes-webhook/webhook/cert.pem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot! This should be variable, just like the ${CA_BUNDLE}. It's differs between different users/deployments.

Copy link
Member

@jpcoenen jpcoenen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels to me like this is not finished yet, am I right? For example, I do not see how the TLS key is generated or the certificate is signed. And there are also some comments by yourself that hint to it not being finished.

- /bin/sh
- -c
args:
- "secrethub read kubernetes-webhook/webhook/cert.pem -o /webhook-certs/cert.pem && secrethub read kubernetes-webhook/webhook/key.pem -o /webhook-certs/key.pem"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for storing these on SecretHub at all? Can't we just generate the key locally and then send a CSR to the k8s CA?

@SimonBarendse
Copy link
Member Author

I'm closing this PR as we're currently focusing our efforts on AWS EKS and GKE.

When we pick this up again, we should consider what's the circular dependency of deploying this as a pod in the same Kubernetes cluster as it applies to. For example, how do we ensure we can scale this deployment with another container when the webhook isn't availabe?

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 this pull request may close these issues.

3 participants