ce7cb702218693d08ea6d83464d2457c9250027c
This commit is contained in:
commit
34c5f8963c
9 changed files with 145336 additions and 0 deletions
35
vendor/infrastructure/cert-manager/config/issuers.yaml
vendored
Normal file
35
vendor/infrastructure/cert-manager/config/issuers.yaml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
apiVersion: cert-manager.io/v1
|
||||
kind: ClusterIssuer
|
||||
metadata:
|
||||
name: vault-internal
|
||||
spec:
|
||||
vault:
|
||||
path: pki_int/sign/cert-manager
|
||||
server: https://vault-active-tls.vault.svc.cluster.local:443
|
||||
serverName: vault-active-direct.vault.svc.cluster.local
|
||||
caBundleSecretRef:
|
||||
name: vault-root-ca
|
||||
key: ca.crt
|
||||
auth:
|
||||
kubernetes:
|
||||
role: cert-manager
|
||||
mountPath: /v1/auth/kubernetes
|
||||
serviceAccountRef:
|
||||
name: cert-manager
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: ClusterIssuer
|
||||
metadata:
|
||||
name: letsencrypt
|
||||
spec:
|
||||
acme:
|
||||
server: https://acme-v02.api.letsencrypt.org/directory
|
||||
email: [email protected]
|
||||
privateKeySecretRef:
|
||||
name: letsencrypt-account-key
|
||||
solvers:
|
||||
- dns01:
|
||||
cloudflare:
|
||||
apiTokenSecretRef:
|
||||
name: cloudflare-api-token
|
||||
key: api-token
|
||||
7
vendor/infrastructure/cert-manager/config/kustomization.yaml
vendored
Normal file
7
vendor/infrastructure/cert-manager/config/kustomization.yaml
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- vault-root-ca.yaml
|
||||
- vso.yaml
|
||||
- vault-auth.yaml
|
||||
- issuers.yaml
|
||||
24
vendor/infrastructure/cert-manager/config/vault-auth.yaml
vendored
Normal file
24
vendor/infrastructure/cert-manager/config/vault-auth.yaml
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: vault-auth
|
||||
namespace: cert-manager
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: [serviceaccounts/token]
|
||||
resourceNames: [cert-manager]
|
||||
verbs: [create]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: vault-auth
|
||||
namespace: cert-manager
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: cert-manager
|
||||
namespace: cert-manager
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: vault-auth
|
||||
20
vendor/infrastructure/cert-manager/config/vault-root-ca.yaml
vendored
Normal file
20
vendor/infrastructure/cert-manager/config/vault-root-ca.yaml
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
apiVersion: secrets.hashicorp.com/v1beta1
|
||||
kind: VaultDynamicSecret
|
||||
metadata:
|
||||
name: vault-root-ca
|
||||
namespace: cert-manager
|
||||
spec:
|
||||
vaultAuthRef: kv
|
||||
mount: pki
|
||||
path: cert/ca
|
||||
requestHTTPMethod: GET
|
||||
refreshAfter: 1h
|
||||
destination:
|
||||
create: true
|
||||
overwrite: true
|
||||
name: vault-root-ca
|
||||
transformation:
|
||||
excludeRaw: true
|
||||
templates:
|
||||
ca.crt:
|
||||
text: '{{ get .Secrets "certificate" }}'
|
||||
31
vendor/infrastructure/cert-manager/config/vso.yaml
vendored
Normal file
31
vendor/infrastructure/cert-manager/config/vso.yaml
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
# VSO syncs the Cloudflare API token from Vault KV -> cert-manager namespace
|
||||
# so the letsencrypt ClusterIssuer can use it for DNS-01 challenges.
|
||||
apiVersion: secrets.hashicorp.com/v1beta1
|
||||
kind: VaultAuth
|
||||
metadata:
|
||||
name: kv
|
||||
namespace: cert-manager
|
||||
spec:
|
||||
method: kubernetes
|
||||
mount: kubernetes
|
||||
kubernetes:
|
||||
role: cert-manager-kv
|
||||
serviceAccount: cert-manager
|
||||
vaultConnectionRef: vault/vault
|
||||
---
|
||||
apiVersion: secrets.hashicorp.com/v1beta1
|
||||
kind: VaultStaticSecret
|
||||
metadata:
|
||||
name: cloudflare-api-token
|
||||
namespace: cert-manager
|
||||
spec:
|
||||
type: kv-v2
|
||||
mount: secret
|
||||
path: cloudflare/cert-manager-dns01
|
||||
destination:
|
||||
name: cloudflare-api-token
|
||||
create: true
|
||||
overwrite: true
|
||||
refreshAfter: 1h
|
||||
vaultAuthRef: kv
|
||||
45
vendor/infrastructure/cert-manager/helm-release.yaml
vendored
Normal file
45
vendor/infrastructure/cert-manager/helm-release.yaml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: cert-manager
|
||||
namespace: cert-manager
|
||||
spec:
|
||||
interval: 15m
|
||||
releaseName: cert-manager
|
||||
targetNamespace: cert-manager
|
||||
chart:
|
||||
spec:
|
||||
chart: cert-manager
|
||||
version: v1.21.3
|
||||
sourceRef:
|
||||
kind: HelmRepository
|
||||
name: jetstack-oci
|
||||
namespace: flux-system
|
||||
install:
|
||||
createNamespace: true
|
||||
remediation:
|
||||
retries: 3
|
||||
upgrade:
|
||||
remediation:
|
||||
retries: 3
|
||||
values:
|
||||
crds:
|
||||
enabled: true
|
||||
replicaCount: 2
|
||||
webhook:
|
||||
replicaCount: 2
|
||||
podDisruptionBudget:
|
||||
enabled: true
|
||||
cainjector:
|
||||
replicaCount: 2
|
||||
podDisruptionBudget:
|
||||
enabled: true
|
||||
podDisruptionBudget:
|
||||
enabled: true
|
||||
extraArgs:
|
||||
- --dns01-recursive-nameservers-only
|
||||
- --dns01-recursive-nameservers=1.1.1.1:53,1.0.0.1:53
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 32Mi
|
||||
6
vendor/infrastructure/cert-manager/kustomization.yaml
vendored
Normal file
6
vendor/infrastructure/cert-manager/kustomization.yaml
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- helm-release.yaml
|
||||
- network-policies.yaml
|
||||
4
vendor/infrastructure/cert-manager/namespace.yaml
vendored
Normal file
4
vendor/infrastructure/cert-manager/namespace.yaml
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: cert-manager
|
||||
145
vendor/infrastructure/cert-manager/network-policies.yaml
vendored
Normal file
145
vendor/infrastructure/cert-manager/network-policies.yaml
vendored
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
---
|
||||
# cert-manager controller: metrics from host (9403), apiserver.
|
||||
apiVersion: cilium.io/v2
|
||||
kind: CiliumNetworkPolicy
|
||||
metadata:
|
||||
name: cert-manager
|
||||
namespace: cert-manager
|
||||
spec:
|
||||
endpointSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: controller
|
||||
ingress:
|
||||
- fromEntities:
|
||||
- host
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "9403"
|
||||
protocol: TCP
|
||||
egress:
|
||||
- toEntities:
|
||||
- kube-apiserver
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "6443"
|
||||
protocol: TCP
|
||||
- toEntities:
|
||||
- world
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "80"
|
||||
protocol: TCP
|
||||
- port: "443"
|
||||
protocol: TCP
|
||||
- port: "53"
|
||||
protocol: UDP
|
||||
- port: "53"
|
||||
protocol: TCP
|
||||
- toEndpoints:
|
||||
- matchLabels:
|
||||
k8s:io.kubernetes.pod.namespace: kube-system
|
||||
k8s-app: kube-dns
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "53"
|
||||
protocol: UDP
|
||||
- port: "53"
|
||||
protocol: TCP
|
||||
- toEndpoints:
|
||||
- matchLabels:
|
||||
k8s:io.kubernetes.pod.namespace: vault
|
||||
app.kubernetes.io/name: vault
|
||||
component: server
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "8200"
|
||||
protocol: TCP
|
||||
---
|
||||
# cert-manager webhook: called by kube-apiserver on 6080, also needs apiserver.
|
||||
apiVersion: cilium.io/v2
|
||||
kind: CiliumNetworkPolicy
|
||||
metadata:
|
||||
name: cert-manager-webhook
|
||||
namespace: cert-manager
|
||||
spec:
|
||||
endpointSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: webhook
|
||||
ingress:
|
||||
- fromEntities:
|
||||
- kube-apiserver
|
||||
- host
|
||||
- remote-node
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "6080"
|
||||
protocol: TCP
|
||||
- port: "10250"
|
||||
protocol: TCP
|
||||
egress:
|
||||
- toEntities:
|
||||
- kube-apiserver
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "6443"
|
||||
protocol: TCP
|
||||
- toEndpoints:
|
||||
- matchLabels:
|
||||
k8s:io.kubernetes.pod.namespace: kube-system
|
||||
k8s-app: kube-dns
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "53"
|
||||
protocol: UDP
|
||||
- port: "53"
|
||||
protocol: TCP
|
||||
---
|
||||
# Host egress to cert-manager pods (webhook, metrics).
|
||||
apiVersion: cilium.io/v2
|
||||
kind: CiliumClusterwideNetworkPolicy
|
||||
metadata:
|
||||
name: host-egress-cert-manager
|
||||
spec:
|
||||
nodeSelector: {}
|
||||
egress:
|
||||
- toEndpoints:
|
||||
- matchLabels:
|
||||
k8s:io.kubernetes.pod.namespace: cert-manager
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "6080"
|
||||
protocol: TCP
|
||||
- port: "9403"
|
||||
protocol: TCP
|
||||
- port: "10250"
|
||||
protocol: TCP
|
||||
|
||||
---
|
||||
# cert-manager cainjector: only needs apiserver.
|
||||
apiVersion: cilium.io/v2
|
||||
kind: CiliumNetworkPolicy
|
||||
metadata:
|
||||
name: cert-manager-cainjector
|
||||
namespace: cert-manager
|
||||
spec:
|
||||
endpointSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: cainjector
|
||||
ingress: []
|
||||
egress:
|
||||
- toEntities:
|
||||
- kube-apiserver
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "6443"
|
||||
protocol: TCP
|
||||
- toEndpoints:
|
||||
- matchLabels:
|
||||
k8s:io.kubernetes.pod.namespace: kube-system
|
||||
k8s-app: kube-dns
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "53"
|
||||
protocol: UDP
|
||||
- port: "53"
|
||||
protocol: TCP
|
||||
Loading…
Reference in a new issue