-
Notifications
You must be signed in to change notification settings - Fork 6
Kubernetes: add cert-manager network policy
#1175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
YuryHrytsuk
merged 6 commits into
ITISFoundation:main
from
YuryHrytsuk:kubernetes-cert-manager-network-policy
Aug 13, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bb22fc6
Kick start
YuryHrytsuk e7f1634
First policy draft
YuryHrytsuk 950e691
Commit chart.lock
YuryHrytsuk 9b5d022
Changes for cert manager network policy
YuryHrytsuk c401189
Add chart.lock
YuryHrytsuk ca6f247
Improve documentation
YuryHrytsuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Patterns to ignore when building packages. | ||
| # This supports shell glob matching, relative path matching, and | ||
| # negation (prefixed with !). Only one pattern per line. | ||
| .DS_Store | ||
| # Common VCS dirs | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .bzrignore | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
| # Common backup files | ||
| *.swp | ||
| *.bak | ||
| *.tmp | ||
| *.orig | ||
| *~ | ||
| # Various IDEs | ||
| .project | ||
| .idea/ | ||
| *.tmproj | ||
| .vscode/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| dependencies: | ||
| - name: cert-manager | ||
| repository: https://charts.jetstack.io | ||
| version: v1.15.3 | ||
| digest: sha256:47142c9b5a4892f942219774d3a7c45368941163d17e56c577fb981da2abad0a | ||
| generated: "2025-08-11T14:55:17.254100391+02:00" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| apiVersion: v2 | ||
| name: cert-manager | ||
| description: A Helm chart for Kubernetes | ||
|
|
||
| # A chart can be either an 'application' or a 'library' chart. | ||
| # | ||
| # Application charts are a collection of templates that can be packaged into versioned archives | ||
| # to be deployed. | ||
| # | ||
| # Library charts provide useful utilities or functions for the chart developer. They're included as | ||
| # a dependency of application charts to inject those utilities and functions into the rendering | ||
| # pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
| type: application | ||
|
|
||
| # This is the chart version. This version number should be incremented each time you make changes | ||
| # to the chart and its templates, including the app version. | ||
| # Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
| version: 1.15.3 | ||
|
|
||
| # This is the version number of the application being deployed. This version number should be | ||
| # incremented each time you make changes to the application. Versions are not expected to | ||
| # follow Semantic Versioning. They should reflect the version the application is using. | ||
| # It is recommended to use it with quotes. | ||
| appVersion: "1.15.3" | ||
|
|
||
| dependencies: | ||
| - name: cert-manager | ||
| version: 1.15.3 | ||
| repository: "https://charts.jetstack.io" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ## Network policy | ||
|
|
||
| Read more https://cert-manager.io/docs/installation/best-practice/#network-requirements | ||
|
|
||
| Be aware that this might have an affect on cert manager webhook application that is called during installation of the cert manager helm chart. If network policy is misconfigured, this will affect installation (e.g. `certissuers` might be missing as they are installed via helm hooks that apparently require cert manager webhook to be reachable) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| This is a wrap around the cert-manager Helm chart. | ||
|
|
||
| NOTE: on network policy change, manual restart of the cert-manager pods might be necessary to apply new rules. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # https://cert-manager.io/docs/installation/best-practice/#network-requirements | ||
| apiVersion: projectcalico.org/v3 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: cert-manager-network-policy | ||
| spec: | ||
| ingress: | ||
| # 2. TCP: Kubernetes (API server) -> cert-manager (webhook) | ||
| - action: Allow | ||
| protocol: TCP | ||
| source: | ||
| # both selectors below did not work | ||
| # selector: 'component == "kube-apiserver"' | ||
| # namespaceSelector: kubernetes.io/metadata.name == "kube-system" | ||
| nets: | ||
| - 10.0.0.0/8 | ||
| - 172.16.0.0/12 | ||
| - 192.168.0.0/16 | ||
| destination: | ||
| selector: 'app.kubernetes.io/component == "webhook"' | ||
| ports: | ||
| # https://stackoverflow.com/a/63863410/12124525 | ||
| - {{ index .Values "cert-manager" "webhook" "securePort" }} | ||
| egress: | ||
| # 3. TCP: cert-manager (webhook, controller, cainjector, startupapicheck) -> Kubernetes API server | ||
| - action: Allow | ||
| protocol: TCP | ||
| destination: | ||
| nets: | ||
| - 10.0.0.0/8 | ||
| - 172.16.0.0/12 | ||
| - 192.168.0.0/16 | ||
| ports: | ||
| - 6443 | ||
| # 6. TCP: cert-manager (controller) -> DNS API endpoints (for ACME DNS01) | ||
| - action: Allow | ||
| protocol: TCP | ||
| source: | ||
| selector: 'app.kubernetes.io/component == "controller"' | ||
| destination: | ||
| ports: | ||
| - 443 | ||
| # 7. UDP / TCP: cert-manager (controller) -> External DNS | ||
| - action: Allow | ||
| protocol: UDP | ||
| source: | ||
| selector: 'app.kubernetes.io/component == "controller"' | ||
| destination: | ||
| ports: | ||
| - 53 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| crds: | ||
| enabled: true | ||
| keep: true | ||
| cert-manager: | ||
| crds: | ||
| enabled: true | ||
| keep: true | ||
|
|
||
| nodeSelector: | ||
| ops: "true" | ||
| nodeSelector: | ||
| ops: "true" | ||
|
|
||
| webhook: | ||
| securePort: 10250 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,36 @@ | ||
| extraObjects: | ||
| - | | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: rfc2136-credentials | ||
| namespace: {{ .Release.Namespace }} # secret must be in same namespace as Cert Manager deployment | ||
| type: Opaque | ||
| data: | ||
| tsig-secret-key: {{ requiredEnv "RFC2136_TSIG_SECRET" | b64enc }} # Base64 encoded Secret Access Key | ||
| - | | ||
| apiVersion: cert-manager.io/v1 | ||
| kind: ClusterIssuer | ||
| metadata: | ||
| name: cert-issuer | ||
| namespace: {{ .Release.Namespace }} | ||
| annotations: | ||
| # ClusterIssuer depends on cert-manager CRDs. We need to wait for them to be installed before creating the ClusterIssuer | ||
| "helm.sh/hook": post-install,post-upgrade | ||
| "helm.sh/hook-weight": "1" | ||
| spec: | ||
| acme: | ||
| email: {{ requiredEnv "OSPARC_DEVOPS_MAIL_ADRESS" }} | ||
| server: {{ requiredEnv "DNS_CHALLENGE_ACME_SERVER" }} | ||
| privateKeySecretRef: | ||
| name: cert-manager-acme-private-key | ||
| solvers: | ||
| - dns01: | ||
| rfc2136: | ||
| nameserver: {{ requiredEnv "RFC2136_NAMESERVER" }} | ||
| tsigKeyName: {{ requiredEnv "RFC2136_TSIG_KEY" }} | ||
| tsigAlgorithm: {{ requiredEnv "RFC2136_TSIG_ALGORITHM_CERT_MANAGER" }} | ||
| tsigSecretSecretRef: | ||
| name: rfc2136-credentials | ||
| key: tsig-secret-key | ||
| cert-manager: | ||
| extraObjects: | ||
| - | | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: rfc2136-credentials | ||
| namespace: {{ .Release.Namespace }} # secret must be in same namespace as Cert Manager deployment | ||
| type: Opaque | ||
| data: | ||
| tsig-secret-key: {{ requiredEnv "RFC2136_TSIG_SECRET" | b64enc }} # Base64 encoded Secret Access Key | ||
| - | | ||
| apiVersion: cert-manager.io/v1 | ||
| kind: ClusterIssuer | ||
| metadata: | ||
| name: cert-issuer | ||
| namespace: {{ .Release.Namespace }} | ||
| annotations: | ||
| # ClusterIssuer depends on cert-manager CRDs. We need to wait for them to be installed before creating the ClusterIssuer | ||
| "helm.sh/hook": post-install,post-upgrade | ||
| "helm.sh/hook-weight": "1" | ||
| spec: | ||
| acme: | ||
| email: {{ requiredEnv "OSPARC_DEVOPS_MAIL_ADRESS" }} | ||
| server: {{ requiredEnv "DNS_CHALLENGE_ACME_SERVER" }} | ||
| privateKeySecretRef: | ||
| name: cert-manager-acme-private-key | ||
| solvers: | ||
| - dns01: | ||
| rfc2136: | ||
| nameserver: {{ requiredEnv "RFC2136_NAMESERVER" }} | ||
| tsigKeyName: {{ requiredEnv "RFC2136_TSIG_KEY" }} | ||
| tsigAlgorithm: {{ requiredEnv "RFC2136_TSIG_ALGORITHM_CERT_MANAGER" }} | ||
| tsigSecretSecretRef: | ||
| name: rfc2136-credentials | ||
| key: tsig-secret-key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,38 @@ | ||
| extraObjects: | ||
| - | | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: route53-credentials | ||
| namespace: {{ .Release.Namespace }} # secret must be in same namespace as Cert Manager deployment | ||
| type: Opaque | ||
| data: | ||
| access-key-id: {{ requiredEnv "DNS_CHALLENGE_AWS_ACCESS_KEY_ID" | b64enc }} | ||
| secret-access-key: {{ requiredEnv "DNS_CHALLENGE_AWS_SECRET_ACCESS_KEY" | b64enc }} | ||
| - | | ||
| apiVersion: cert-manager.io/v1 | ||
| kind: ClusterIssuer | ||
| metadata: | ||
| name: cert-issuer | ||
| namespace: {{ .Release.Namespace }} | ||
| annotations: | ||
| # ClusterIssuer depends on cert-manager CRDs. We need to wait for them to be installed before creating the ClusterIssuer | ||
| "helm.sh/hook": post-install,post-upgrade | ||
| "helm.sh/hook-weight": "1" | ||
| spec: | ||
| acme: | ||
| email: {{ requiredEnv "OSPARC_DEVOPS_MAIL_ADRESS" }} | ||
| server: {{ requiredEnv "DNS_CHALLENGE_ACME_SERVER" }} | ||
| privateKeySecretRef: | ||
| name: cert-manager-acme-private-key | ||
| solvers: | ||
| - dns01: | ||
| route53: | ||
| region: {{ requiredEnv "DNS_CHALLENGE_AWS_REGION" }} | ||
| accessKeyIDSecretRef: | ||
| name: route53-credentials | ||
| key: access-key-id | ||
| secretAccessKeySecretRef: | ||
| name: route53-credentials | ||
| key: secret-access-key | ||
| cert-manager: | ||
| extraObjects: | ||
| - | | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: route53-credentials | ||
| namespace: {{ .Release.Namespace }} # secret must be in same namespace as Cert Manager deployment | ||
| type: Opaque | ||
| data: | ||
| access-key-id: {{ requiredEnv "DNS_CHALLENGE_AWS_ACCESS_KEY_ID" | b64enc }} | ||
| secret-access-key: {{ requiredEnv "DNS_CHALLENGE_AWS_SECRET_ACCESS_KEY" | b64enc }} | ||
| - | | ||
| apiVersion: cert-manager.io/v1 | ||
| kind: ClusterIssuer | ||
| metadata: | ||
| name: cert-issuer | ||
| namespace: {{ .Release.Namespace }} | ||
| annotations: | ||
| # ClusterIssuer depends on cert-manager CRDs. We need to wait for them to be installed before creating the ClusterIssuer | ||
| "helm.sh/hook": post-install,post-upgrade | ||
| "helm.sh/hook-weight": "1" | ||
| spec: | ||
| acme: | ||
| email: {{ requiredEnv "OSPARC_DEVOPS_MAIL_ADRESS" }} | ||
| server: {{ requiredEnv "DNS_CHALLENGE_ACME_SERVER" }} | ||
| privateKeySecretRef: | ||
| name: cert-manager-acme-private-key | ||
| solvers: | ||
| - dns01: | ||
| route53: | ||
| region: {{ requiredEnv "DNS_CHALLENGE_AWS_REGION" }} | ||
| accessKeyIDSecretRef: | ||
| name: route53-credentials | ||
| key: access-key-id | ||
| secretAccessKeySecretRef: | ||
| name: route53-credentials | ||
| key: secret-access-key |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.