Skip to content

Commit 593c073

Browse files
committed
[OSDOCS-14647]: Config custom API server cert for a hosted cluster
1 parent 7ed14ec commit 593c073

File tree

8 files changed

+137
-15
lines changed

8 files changed

+137
-15
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
@@ -52,19 +52,24 @@ include::modules/hcp-aws-deploy-hc.adoc[leveloffset=+1]
5252

5353
[role="_additional-resources"]
5454
.Additional resources
55-
5655
* xref:../../hosted_control_planes/hcp-deploy/hcp-deploy-aws.adoc#hcp-enable-arm-amd_hcp-deploy-aws[Running hosted clusters on an ARM64 architecture]
5756
57+
include::modules/hcp-access-hc-aws.adoc[leveloffset=+2]
58+
5859
include::modules/hcp-access-pub-hc-aws.adoc[leveloffset=+2]
5960

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

63+
include::modules/hcp-custom-cert.adoc[leveloffset=+1]
64+
6265
include::modules/hc-create-aws-multi-zones.adoc[leveloffset=+1]
6366

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

6669
include::modules/hcp-enable-arm-amd.adoc[leveloffset=+1]
70+
6771
include::modules/hcp-create-hc-arm64-aws.adoc[leveloffset=+2]
72+
6873
include::modules/hcp-create-np-arm64-aws.adoc[leveloffset=+2]
6974

7075
[role="_additional-resources"]

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,70 @@ The {mce-short} supports only the default `local-cluster`, which is a hub cluste
1919

2020
A _hosted cluster_ is an {product-title} cluster with its API endpoint and control plane that are hosted on the management cluster. The hosted cluster includes the control plane and its corresponding data plane. You can use the {mce-short} console or the hosted control plane command-line interface, `hcp`, to create a hosted cluster.
2121

22-
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}_.
22+
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}".
2323

2424
include::modules/hcp-bm-prepare.adoc[leveloffset=+1]
25+
2526
include::modules/hcp-bm-prereqs.adoc[leveloffset=+2]
2627

2728
[role="_additional-resources"]
2829
.Additional resources
30+
2931
* link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.14/html/clusters/cluster_mce_overview#advanced-config-engine[Advanced configuration]
32+
3033
* link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.14/html/clusters/cluster_mce_overview#enable-cim[Enabling the central infrastructure management service]
3134
3235
include::modules/hcp-bm-firewall-port-svc-reqs.adoc[leveloffset=+2]
3336

3437
[role="_additional-resources"]
3538
.Additional resources
39+
3640
* xref:../../networking/configuring_network_settings/enable-cluster-wide-proxy.adoc#enable-cluster-wide-proxy[Configuring the cluster-wide proxy]
3741
3842
include::modules/hcp-bm-infra-reqs.adoc[leveloffset=+2]
3943

4044
[role="_additional-resources"]
4145
.Additional resources
46+
4247
* xref:../../etcd/etcd-practices.adoc#recommended-etcd-practices[Recommended etcd practices]
48+
4349
* xref:../../storage/persistent_storage/persistent_storage_local/persistent-storage-using-lvms.adoc[Persistent storage using {lvms}]
50+
4451
* xref:../../hosted_control_planes/hcp-import.adoc#hcp-import-disable_hcp-import[Disabling the automatic import of hosted clusters into {mce-short}]
52+
4553
* xref:../../hosted_control_planes/hcp-prepare/hcp-enable-disable.adoc[Enabling or disabling the {hcp} feature]
54+
4655
* link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.14/html/clusters/cluster_mce_overview#ansible-config-hosted-cluster[Configuring Ansible Automation Platform jobs to run on hosted clusters]
4756
4857
include::modules/hcp-bm-dns.adoc[leveloffset=+1]
58+
4959
include::modules/hcp-custom-dns.adoc[leveloffset=+2]
5060

5161
include::modules/hcp-bm-hc.adoc[leveloffset=+1]
5262

5363
[role="_additional-resources"]
5464
.Additional resources
65+
5566
* xref:../../hosted_control_planes/hcp-import.adoc[Manually importing a hosted cluster]
5667
5768
include::modules/hcp-bm-hc-console.adoc[leveloffset=+2]
5869

5970
.Next steps
71+
6072
* To access the web console, see xref:../../web_console/web-console.adoc#web-console-overview[Accessing the web console].
6173
6274
include::modules/hcp-bm-hc-mirror.adoc[leveloffset=+2]
6375

6476
.Next steps
77+
6578
* To create credentials that you can reuse when you create a hosted cluster with the console, see link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.14/html/clusters/cluster_mce_overview#creating-a-credential-for-an-on-premises-environment[Creating a credential for an on-premises environment].
79+
6680
* To access a hosted cluster, see xref:../../hosted_control_planes/hcp-manage/hcp-manage-bm.adoc#hcp-bm-access_hcp-manage-bm[Accessing the hosted cluster].
81+
6782
* 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.14/html/clusters/cluster_mce_overview#add-host-host-inventory[Adding hosts to the host inventory by using the Discovery Image].
83+
6884
* To extract the {product-title} release image digest, see link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.14/html/clusters/cluster_mce_overview#configure-hosted-disconnected-digest-image[Extracting the {product-title} release image digest].
6985
7086
include::modules/hcp-bm-verify.adoc[leveloffset=+1]
87+
88+
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.14/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:4/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-custom-dns.adoc[leveloffset=+2]
5760

5861
include::modules/hcp-non-bm-hc.adoc[leveloffset=+1]
@@ -81,3 +84,5 @@ include::modules/hcp-bm-hc-mirror.adoc[leveloffset=+2]
8184
* To extract the {product-title} release image digest, see link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.14/html/clusters/cluster_mce_overview#configure-hosted-disconnected-digest-image[Extracting the {product-title} release image digest].
8285
8386
include::modules/hcp-non-bm-verify.adoc[leveloffset=+1]
87+
88+
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
@@ -99,3 +99,5 @@ include::modules/hcp-virt-add-node.adoc[leveloffset=+2]
9999
* 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].
100100

101101
include::modules/hcp-virt-verify-hc.adoc[leveloffset=+1]
102+
103+
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: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,28 @@ Before you can create and manage hosted clusters on {aws-first}, you must create
1414
+
1515
[source,terminal]
1616
----
17-
$ aws s3api create-bucket --bucket <bucket_name> \// <1>
18-
--create-bucket-configuration LocationConstraint=<region> \// <2>
19-
--region <region> <2>
17+
$ aws s3api create-bucket --bucket <bucket_name> \
18+
--create-bucket-configuration LocationConstraint=<region> \
19+
--region <region>
2020
----
2121
+
22-
<1> Replace `<bucket_name>` with the name of the S3 bucket you are creating.
23-
<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.
22+
where:
23+
+
24+
--
25+
<bucket_name>:: Is the name of the S3 bucket you are creating.
26+
<region>:: 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.
27+
--
2428
+
2529
[source,terminal]
2630
----
27-
$ aws s3api delete-public-access-block --bucket <bucket_name> <1>
31+
$ aws s3api delete-public-access-block --bucket <bucket_name>
2832
----
2933
+
30-
<1> Replace `<bucket_name>` with the name of the S3 bucket you are creating.
34+
where:
35+
+
36+
--
37+
<bucket_name>:: Is the name of the S3 bucket you are creating.
38+
--
3139
+
3240
[source,terminal]
3341
----
@@ -38,21 +46,29 @@ $ echo '{
3846
"Effect": "Allow",
3947
"Principal": "*",
4048
"Action": "s3:GetObject",
41-
"Resource": "arn:aws:s3:::<bucket_name>/*" <1>
49+
"Resource": "arn:aws:s3:::<bucket_name>/*"
4250
}
4351
]
4452
}' | envsubst > policy.json
4553
----
4654
+
47-
<1> Replace `<bucket_name>` with the name of the S3 bucket you are creating.
55+
where:
56+
+
57+
--
58+
<bucket_name>:: Is the name of the S3 bucket you are creating.
59+
--
4860
+
4961
[source,terminal]
5062
----
51-
$ aws s3api put-bucket-policy --bucket <bucket_name> \// <1>
63+
$ aws s3api put-bucket-policy --bucket <bucket_name> \
5264
--policy file://policy.json
5365
----
5466
+
55-
<1> Replace `<bucket_name>` with the name of the S3 bucket you are creating.
67+
where:
68+
+
69+
--
70+
<bucket_name>:: Is the name of the S3 bucket you are creating.
71+
--
5672
+
5773
[NOTE]
5874
====

modules/hcp-custom-cert.adoc

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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`: They 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 <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:
51+
- api-custom-cert-sample-hosted.sample-hosted.example.com
52+
servingCertificate:
53+
name: sample-hosted-kas-custom-cert
54+
----
55+
+
56+
where:
57+
+
58+
--
59+
names:: The list of DNS names that the certificate is valid for.
60+
servingCertificate.name:: The name of the secret that contains the custom certificate.
61+
--
62+
63+
. Apply the changes to your `HostedCluster` configuration by entering the following command:
64+
+
65+
[source,terminal]
66+
----
67+
$ oc apply -f <hosted_cluster_config>.yaml
68+
----
69+
70+
.Verification
71+
72+
* Check the API server pods to ensure that the new certificate is mounted.
73+
74+
* Test the conncetion to the API server by using the custom domain name.
75+
76+
* Verify the certificate details in your browser or by using tools such as `openssl`.

security/certificates/api-server.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ by one that is issued by a CA that clients trust.
1313

1414
[NOTE]
1515
====
16-
In hosted control plane clusters, you can add as many custom certificates to your Kubernetes API Server as you need. However, do not add a certificate for the endpoint that worker nodes use to communicate with the control plane.
16+
In hosted control plane clusters, you can add as many custom certificates to your Kubernetes API Server as you need. However, do not add a certificate for the endpoint that worker nodes use to communicate with the control plane. For more information, see xref:../hosted_control_planes/hcp-deploy/hcp-deploy-bm.adoc#hcp-custom-cert_hcp-deploy-bm[Configuring a custom API server certificate in a hosted cluster].
1717
====
1818

1919
include::modules/customize-certificates-api-add-named.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)