Generating custom certificates manually for IKS
You can manually prepare Certificate definitions for use when generating custom certificates for IKS.
About this task
The following instructions describe how to prepare Certificate definitions manually for the purpose of using them to have Cert-Manager generate Certificates for you.
Procedure
-
Create a Certificate Authority (CA) and an Issuer for Signing
-
The following YAML definition can be used to generate a CA named
ingress-ca
, and an Issuer namedingress-issuer
using that CA:--- apiVersion: cert-manager.io/v1alpha2 kind: Certificate metadata: name: ingress-ca spec: secretName: ingress-ca commonName: "ingress-ca" usages: - digital signature - key encipherment - cert sign isCA: true issuerRef: name: selfsigning-issuer kind: Issuer --- apiVersion: cert-manager.io/v1alpha2 kind: Issuer metadata: name: ingress-issuer spec: ca: secretName: ingress-ca
This should be placed into a file, e.g.
ingress-ca.yaml
. - Apply this file into the Cluster:
. This will create a CA Certificate namedkubectl apply -f ingress-ca.yaml -n <namespace>
ingress-ca
, and also a Secret namedingress-ca
. This CA will be used to sign the rest of the custom certificates. - Verify the presence of both
files:
kubectl get certificate -n <namespace> kubectl get secret -n <namespace>
-
- Generating Common Subsystem Communication Certificates with Cert-Manager for Management
CR:
- Use the following YAML definition to generate the following Common Certificates and Secrets -
analytics-ingestion-client
, andportal-admin-client
:apiVersion: cert-manager.io/v1alpha2 kind: Certificate metadata: name: analytics-ingestion-client spec: commonName: analytics-ingestion-client secretName: analytics-ingestion-client issuerRef: name: ingress-issuer usages: - "client auth" - "signing" - "key encipherment" duration: 17520h # 2 years renewBefore: 48h --- apiVersion: cert-manager.io/v1alpha2 kind: Certificate metadata: name: portal-admin-client spec: commonName: portal-admin-client secretName: portal-admin-client issuerRef: name: ingress-issuer usages: - "client auth" - "signing" - "key encipherment" duration: 17520h # 2 years renewBefore: 48h ---
Note that the
issuerRef
uses the Issuer created in Step 1. These certificates must be signed by the CA associated with that Issuer,ingress-ca
. This should be placed into a file, e.g.common-certs.yaml
. - Apply this file into the Cluster:
This will create Client Certificates and Secrets namedkubectl apply -f icommon-certs.yaml -n <namespace>
analytics-ingestion-client
, andportal-admin-client
. - Verify the presence of both
files:
kubectl get certificate -n <namespace> kubectl get secret -n <namespace>
- Use the following YAML definition to generate the following Common Certificates and Secrets -
- External Frontend/Endpoint Certificates with Cert-Manager
- For each Endpoint in each subsystem CR, the following YAML definition may be
used to generate a Server
Certificate:
apiVersion: cert-manager.io/v1alpha2 kind: Certificate metadata: name: <endpoint-host.secretName> spec: commonName: <endpoint.host.secretName> secretName: <endpoint.host.secretName> dnsNames: - <endpoint.host.Name> issuerRef: name: ingress-issuer usages: - "server auth" - "signing" - "key encipherment" duration: 17520h # 2 years renewBefore: 48h
Replace
<endpoint.host.secretName>
with thesecretName
in thehost
block of theEndpoint
in the CR. For example, if theEndpoint
in the CR is:cloudManagerEndpoint: hosts: - name: admin.example.com secretName: cm-endpoint
The Certificate YAML should be updated as follows:
--- apiVersion: cert-manager.io/v1alpha2 kind: Certificate metadata: name: cm-endpoint spec: commonName: cm-endpoint secretName: cm-endpoint dnsNames: - admin.example.com issuerRef: name: ingress-issuer usages: - "server auth" - "signing" - "key encipherment" duration: 17520h # 2 years renewBefore: 48h
Note that the
issuerRef
uses the Issuer created previously. This certificate will be signed by the CA associated with that Issuer,ingress-ca
. This should be placed into a file, for example<subsystem>-server.yaml
. - Apply this file into the Cluster:
This will create a Server Certificate namedkubectl apply -f <subsystem>-server.yaml -n <namespace>
<subsystem>-server
, and also a Secret named<subsystem>-server
. - Verify the presence of both
files:
kubectl get certificate -n <namespace> kubectl get secret -n <namespace>
- Repeat Steps 3.a
3.b and 3.c for each subsystem. In each case, the
Certificates must use the same Issuer created in Step 1. This will ensure that all custom certificates are signed by the same CA
Certificate.
Note that the
issuerRef
uses theIssuer
created in 1. These certificates must be signed by the CA associated with that Issuer,ingress-ca
. - Place the YAML definitions for each Certificate into a YAML file, e.g.
endpoint-certs.yaml
. This will create Server Certificates and Secrets for each Endpoint named<endpoint.host.secretName>
. . - Apply this file into the Cluster:
kubectl apply -f endpoint-certs.yaml
- Verify the presence of
both:
kubectl get certificate -n <namespace> kubectl get secret -n <namespace>
- For each Endpoint in each subsystem CR, the following YAML definition may be
used to generate a Server
Certificate:
- Choose one of the following actions, based on whether or not you are customizing internal
API certificates:
- If you do not plan to customize internal certificates, continue with Installing API Connect on IKS with custom certificates.
- If you plan to customize internal certificates, continue with Step 5.
Note:- It is not recommended to customize Internal certificates unless you have a specific requirement to do so. You must also provide custom certificates for all the Common Subsystem Communication, and External Frontend/Ingress certificates described in the previous sections.
- For internal certificates, custom certificates must be provided for all internal certificates in each subsystem CR. Only providing custom certificates for some is not supported, and will be rejected by Operator validation.
- Generate custom internal certificates using
custom-cert-ingresses-internal.yaml
[Each of the Internal certificates listed in Custom certificates reference for IKS have differing strict requirements for Common Names and DNS Names (i.e. Subject Alternative Names).
To generate custom certificates that meet these requirements, use the provided
custom-certs-internal.yaml
file, which can be found in thehelper_files
installation archive.This file contains Certificate YAML definitions for all Internal certificates, CA, and Issuer that can be customized for each subsystem of IBM API Connect. The Certificate definitions file is already populated with the recommended default values.
- When using custom internal certificates, you are required to specify a site name.
The site name is used as the identifier for the PostgreSQL database Cluster used by API Connect. The
site name chosen is added to the Management Subsystem CR YAML file before installing the Management
Subsystem.
In addition, this name is also required for use with the custom internal certificates, so a site name should be chosen now before proceeding.
- Open
custom-certs-internal.yaml
in a text-editor. Find and replace each occurrence of<namespace>
with the desired namespace for the deployment. This must be done even if thedefault
namespace is to be used. - Also in
custom-certs-internal.yaml
, if thedefault
namespace is not being used for the deployment, find the followingdb-server-certificate
Certificate definition:--- apiVersion: cert-manager.io/v1alpha2 kind: Certificate metadata: name: db-server-certificate spec: commonName: management-pgo_cluster_id-postgres secretName: db-server-certificate dnsNames: - "*.default" - "*.default.svc" - "*.management-pgo_cluster_id-postgres.default.svc" - "management-pgo_cluster_id-postgres"
Replace the instances of
default
with the namespace being used for the deployment. For example, if a namespace calledapic
is being used, the definition should be updated to appear as follows:--- apiVersion: cert-manager.io/v1alpha2 kind: Certificate metadata: name: db-server-certificate spec: commonName: management-pgo_cluster_id-postgres secretName: db-server-certificate dnsNames: - "*.apic" - "*.apic.svc" - "*.management-pgo_cluster_id-postgres.apic.svc" - "management-pgo_cluster_id-postgres"
- Also in
custom-certs-internal.yaml
, replace each occurrence ofpgo_cluster_id
with the chosen site name described in Step 5.a. - Apply the file to the
Cluster:
kubectl apply -f custom-certs-internal.yaml -n <namespace>
- Continue with Installing API Connect on IKS with custom certificates.
- When using custom internal certificates, you are required to specify a site name.
The site name is used as the identifier for the PostgreSQL database Cluster used by API Connect. The
site name chosen is added to the Management Subsystem CR YAML file before installing the Management
Subsystem.