Skip to content

Commit c7279c9

Browse files
authored
Merge pull request #97515 from lahinson/osdocs-14647-cp-4.17
[enterprise-4.17][OSDOCS-14647]: Config custom API server cert for a hosted cluster
2 parents 4aac4e1 + 002a891 commit c7279c9

File tree

7 files changed

+91
-7
lines changed

7 files changed

+91
-7
lines changed

hosted_control_planes/hcp-deploy/hcp-deploy-aws.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,24 @@ include::modules/hcp-aws-deploy-hc.adoc[leveloffset=+1]
5050

5151
[role="_additional-resources"]
5252
.Additional resources
53-
5453
* xref:../../hosted_control_planes/hcp-deploy/hcp-deploy-aws.adoc#hcp-enable-arm-amd_hcp-deploy-aws[Running hosted clusters on an ARM64 architecture]
5554
55+
include::modules/hcp-access-hc-aws.adoc[leveloffset=+2]
56+
5657
include::modules/hcp-access-pub-hc-aws.adoc[leveloffset=+2]
5758

5859
include::modules/hcp-access-pub-hc-aws-cli.adoc[leveloffset=+2]
5960

61+
include::modules/hcp-custom-cert.adoc[leveloffset=+1]
62+
6063
include::modules/hc-create-aws-multi-zones.adoc[leveloffset=+1]
6164

6265
include::modules/hcp-create-hc-multi-zone-aws-creds.adoc[leveloffset=+2]
6366

6467
include::modules/hcp-enable-arm-amd.adoc[leveloffset=+1]
68+
6569
include::modules/hcp-create-hc-arm64-aws.adoc[leveloffset=+2]
70+
6671
include::modules/hcp-create-np-arm64-aws.adoc[leveloffset=+2]
6772

6873
[role="_additional-resources"]

hosted_control_planes/hcp-deploy/hcp-deploy-bm.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,6 @@ include::modules/hcp-bm-hc-mirror.adoc[leveloffset=+2]
7373
* To add hosts to the host inventory by using the Discovery Image, see link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.12/html/clusters/cluster_mce_overview#add-host-host-inventory[Adding hosts to the host inventory by using the Discovery Image].
7474
* To extract the {product-title} release image digest, see link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.12/html/clusters/cluster_mce_overview#configure-hosted-disconnected-digest-image[Extracting the {product-title} release image digest].
7575
76-
include::modules/hcp-bm-verify.adoc[leveloffset=+1]
76+
include::modules/hcp-bm-verify.adoc[leveloffset=+1]
77+
78+
include::modules/hcp-custom-cert.adoc[leveloffset=+1]

hosted_control_planes/hcp-deploy/hcp-deploy-non-bm.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ A _hosted cluster_ is an {product-title} cluster with its API endpoint and contr
2525
The hosted cluster is automatically imported as a managed cluster. If you want to disable this automatic import feature, see "Disabling the automatic import of hosted clusters into {mce-short}".
2626

2727
include::modules/hcp-non-bm-prepare.adoc[leveloffset=+1]
28+
2829
include::modules/hcp-non-bm-prereqs.adoc[leveloffset=+2]
2930

3031
[role="_additional-resources"]
@@ -35,6 +36,7 @@ include::modules/hcp-non-bm-prereqs.adoc[leveloffset=+2]
3536
* link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.12/html/clusters/cluster_mce_overview#enable-cim[Enabling the central infrastructure management service]
3637
3738
include::modules/hcp-non-bm-firewall-port-svc-reqs.adoc[leveloffset=+2]
39+
3840
include::modules/hcp-non-bm-infra-reqs.adoc[leveloffset=+2]
3941

4042
[role="_additional-resources"]
@@ -53,6 +55,7 @@ include::modules/hcp-non-bm-infra-reqs.adoc[leveloffset=+2]
5355
* link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.12/html/clusters/cluster_mce_overview#ansible-config-hosted-cluster[Configuring Ansible Automation Platform jobs to run on hosted clusters]
5456
5557
include::modules/hcp-non-bm-dns.adoc[leveloffset=+1]
58+
5659
include::modules/hcp-non-bm-hc.adoc[leveloffset=+1]
5760

5861
[role="_additional-resources"]
@@ -79,3 +82,5 @@ include::modules/hcp-bm-hc-mirror.adoc[leveloffset=+2]
7982
* To extract the {product-title} release image digest, see link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.12/html/clusters/cluster_mce_overview#configure-hosted-disconnected-digest-image[Extracting the {product-title} release image digest].
8083
8184
include::modules/hcp-non-bm-verify.adoc[leveloffset=+1]
85+
86+
include::modules/hcp-custom-cert.adoc[leveloffset=+1]

hosted_control_planes/hcp-deploy/hcp-deploy-virt.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,5 @@ include::modules/hcp-virt-add-node.adoc[leveloffset=+2]
9898
* To scale down the data plane to zero, see link:https://access.redhat.com/documentation/en-us/openshift_container_platform/4.15/html/hosted_control_planes/troubleshooting-hosted-control-planes#scale-down-data-plane_hcp-troubleshooting[Scaling down the data plane to zero].
9999

100100
include::modules/hcp-virt-verify-hc.adoc[leveloffset=+1]
101+
102+
include::modules/hcp-custom-cert.adoc[leveloffset=+1]

modules/hcp-access-hc-aws.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// * hosted-control-planes/hcp-deploy/hcp-deploy-aws.adoc
44

55
:_mod-docs-content-type: PROCEDURE
6-
[id="hcp-create-private-hc-aws_{context}"]
6+
[id="hcp-access-hc-aws_{context}"]
77
= Accessing a hosted cluster on {aws-short}
88

99
You can access the hosted cluster by getting the `kubeconfig` file and the `kubeadmin` credentials directly from resources.

modules/hcp-aws-create-secret-s3.adoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ $ aws s3api create-bucket --bucket <bucket_name> \// <1>
1818
--create-bucket-configuration LocationConstraint=<region> \// <2>
1919
--region <region> <2>
2020
----
21-
+
2221
<1> Replace `<bucket_name>` with the name of the S3 bucket you are creating.
2322
<2> To create the bucket in a region other than the `us-east-1` region, include this line and replace `<region>` with the region you want to use. To create a bucket in the `us-east-1` region, omit this line.
23+
2424
+
2525
[source,terminal]
2626
----
2727
$ aws s3api delete-public-access-block --bucket <bucket_name> <1>
2828
----
29-
+
3029
<1> Replace `<bucket_name>` with the name of the S3 bucket you are creating.
30+
3131
+
3232
[source,terminal]
3333
----
@@ -43,15 +43,14 @@ $ echo '{
4343
]
4444
}' | envsubst > policy.json
4545
----
46-
+
4746
<1> Replace `<bucket_name>` with the name of the S3 bucket you are creating.
47+
4848
+
4949
[source,terminal]
5050
----
5151
$ aws s3api put-bucket-policy --bucket <bucket_name> \// <1>
5252
--policy file://policy.json
5353
----
54-
+
5554
<1> Replace `<bucket_name>` with the name of the S3 bucket you are creating.
5655
+
5756
[NOTE]

modules/hcp-custom-cert.adoc

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * hosted-control-planes/hcp-deploy/hcp-deploy-aws.adoc
4+
// * hosted-control-planes/hcp-deploy/hcp-deploy-bm.adoc
5+
// * hosted-control-planes/hcp-deploy/hcp-deploy-non-bm.adoc
6+
// * hosted-control-planes/hcp-deploy/hcp-deploy-virt.adoc
7+
8+
:_mod-docs-content-type: PROCEDURE
9+
[id="hcp-custom-cert_{context}"]
10+
= Configuring a custom API server certificate in a hosted cluster
11+
12+
To configure a custom certificate for the API server, specify the certificate details in the `spec.configuration.apiServer` section of your `HostedCluster` configuration.
13+
14+
You can configure a custom certificate during either day-1 or day-2 operations. However, because the service publishing strategy is immutable after you set it during hosted cluster creation, you must know what the hostname is for the Kubernetes API server that you plan to configure.
15+
16+
.Prerequisites
17+
18+
* You created a Kubernetes secret that contains your custom certificate in the management cluster. The secret contains the following keys:
19+
20+
** `tls.crt`: The certificate
21+
** `tls.key`: The private key
22+
23+
* If your `HostedCluster` configuration includes a service publishing strategy that uses a load balancer, ensure that the Subject Alternative Names (SANs) of the certificate do not conflict with the internal API endpoint (`api-int`). The internal API endpoint is automatically created and managed by your platform. If you use the same hostname in both the custom certificate and the internal API endpoint, routing conflictcs can occur. The only exception to this rule is when you use {aws-short} as the provider with either `Private` or `PublicAndPrivate` configurations. In those cases, the SAN conflict is managed by the platform.
24+
25+
* The certificate must be valid for the external API endpoint.
26+
27+
* The validity period of the certificate aligns with your cluster's expected life cycle.
28+
29+
.Procedure
30+
31+
. Create a secret with your custom certificate by entering the following command:
32+
+
33+
[source,terminal]
34+
----
35+
$ oc create secret tls sample-hosted-kas-custom-cert \
36+
--cert=path/to/cert.crt \
37+
--key=path/to/key.key \
38+
-n <hosted_cluster_namespace>
39+
----
40+
41+
. Update your `HostedCluster` configuration with the custom certificate details, as shown in the following example:
42+
+
43+
[source,yaml]
44+
----
45+
spec:
46+
configuration:
47+
apiServer:
48+
servingCerts:
49+
namedCertificates:
50+
- names: <1>
51+
- api-custom-cert-sample-hosted.sample-hosted.example.com
52+
servingCertificate: <2>
53+
name: sample-hosted-kas-custom-cert
54+
----
55+
<1> The list of DNS names that the certificate is valid for.
56+
<2> The name of the secret that contains the custom certificate.
57+
58+
. Apply the changes to your `HostedCluster` configuration by entering the following command:
59+
+
60+
[source,terminal]
61+
----
62+
$ oc apply -f <hosted_cluster_config>.yaml
63+
----
64+
65+
.Verification
66+
67+
* Check the API server pods to ensure that the new certificate is mounted.
68+
69+
* Test the conncetion to the API server by using the custom domain name.
70+
71+
* Verify the certificate details in your browser or by using tools such as `openssl`.

0 commit comments

Comments
 (0)