cert-manager: Add cert-exporter CronJob
The `cert-exporter` tool fetches certificates from Kubernetes Secret resources and commits them to a Git repository. This allows certificates managed by *cert-manager* to be used outside the Kubernetes cluster, e.g. for services running on other virtual machines.dch-webhooks-secrets
parent
e3d9fc2489
commit
7a27855e51
|
@ -1,2 +1,3 @@
|
||||||
|
cert-exporter.pem
|
||||||
cert-manager.key
|
cert-manager.key
|
||||||
zerossl.secret
|
zerossl.secret
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: cert-exporter
|
||||||
|
namespace: cert-manager
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: cert-exporter
|
||||||
|
namespace: cert-manager
|
||||||
|
data:
|
||||||
|
config.yml: |
|
||||||
|
git_repo: gitea@git.pyrocufflink.blue:dustin/certs.git
|
||||||
|
certs:
|
||||||
|
- name: pyrocufflink-cert
|
||||||
|
namespace: default
|
||||||
|
key: certificates/_.pyrocufflink.net.key
|
||||||
|
cert: certificates/_.pyrocufflink.net.crt
|
||||||
|
bundle: certificates/_.pyrocufflink.net.pem
|
||||||
|
known-hosts-command.ssh_config: |
|
||||||
|
KnownHostsCommand /usr/bin/curl -fsL https://files.pyrocufflink.blue/ssh_known_hosts
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: cert-exporter
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- ''
|
||||||
|
resources:
|
||||||
|
- secrets
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
resourceNames:
|
||||||
|
- pyrocufflink-cert
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: cert-exporter
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: cert-exporter
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: cert-exporter
|
||||||
|
namespace: cert-manager
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: cert-exporter
|
||||||
|
namespace: cert-manager
|
||||||
|
spec:
|
||||||
|
timeZone: America/Chicago
|
||||||
|
schedule: '27 20 * * *'
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: git.pyrocufflink.net/containerimages/cert-exporter
|
||||||
|
name: cert-exporter
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /etc/cert-exporter/config.yml
|
||||||
|
name: config
|
||||||
|
subPath: config.yml
|
||||||
|
readOnly: true
|
||||||
|
- mountPath: /home/cert-exporter/.ssh/id_ed25519
|
||||||
|
name: sshkeys
|
||||||
|
subPath: cert-exporter.pem
|
||||||
|
readOnly: true
|
||||||
|
- mountPath: /etc/ssh/ssh_config.d/known-hosts-command.conf
|
||||||
|
name: config
|
||||||
|
subPath: known-hosts-command.ssh_config
|
||||||
|
readOnly: true
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 1000
|
||||||
|
serviceAccount: cert-exporter
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: cert-exporter
|
||||||
|
- name: sshkeys
|
||||||
|
secret:
|
||||||
|
secretName: cert-exporter-sshkey
|
||||||
|
defaultMode: 00440
|
||||||
|
restartPolicy: Never
|
|
@ -5,6 +5,7 @@ resources:
|
||||||
- cert-manager.yaml
|
- cert-manager.yaml
|
||||||
- cluster-issuer.yaml
|
- cluster-issuer.yaml
|
||||||
- certificates.yaml
|
- certificates.yaml
|
||||||
|
- cert-exporter.yaml
|
||||||
|
|
||||||
secretGenerator:
|
secretGenerator:
|
||||||
- name: cert-manager-tsig
|
- name: cert-manager-tsig
|
||||||
|
@ -20,3 +21,10 @@ secretGenerator:
|
||||||
- zerossl.secret
|
- zerossl.secret
|
||||||
options:
|
options:
|
||||||
disableNameSuffixHash: true
|
disableNameSuffixHash: true
|
||||||
|
|
||||||
|
- name: cert-exporter-sshkey
|
||||||
|
namespace: cert-manager
|
||||||
|
files:
|
||||||
|
- cert-exporter.pem
|
||||||
|
options:
|
||||||
|
disableNameSuffixHash: true
|
||||||
|
|
Loading…
Reference in New Issue