|
| 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-virt.adoc |
| 6 | +// * hosted_control_planes/hcp-deploy/hcp-deploy-non-bm.adoc |
| 7 | +// * hosted_control_planes/hcp-deploy/hcp-deploy-ibm-power.adoc |
| 8 | +// * hosted_control_planes/hcp-deploy/hcp-deploy-ibmz.adoc |
| 9 | + |
| 10 | +:_mod-docs-content-type: PROCEDURE |
| 11 | +[id="hcp-custom-dns_{context}"] |
| 12 | += Defining a custom DNS name |
| 13 | + |
| 14 | +As a cluster administrator, you can create a hosted cluster with an external API DNS name that is different from the internal endpoint that is used for node bootstraps and control plane communication. You might want to define a different DNS name for the following reasons: |
| 15 | + |
| 16 | +* To replace the user-facing TLS certificate with one from a public CA without breaking the control plane functions that are bound to the internal root CA |
| 17 | +* To support split-horizon DNS and NAT scenarios |
| 18 | +* To ensure a similar experience to standalone control planes, where you can use functions, such as the "Show Login Command" function, with the correct `kubeconfig` and DNS configuration |
| 19 | +
|
| 20 | +You can define a DNS name either during your initial setup or during day-2 operations, by entering a domain name in the `kubeAPIServerDNSName` field of a `HostedCluster` object. |
| 21 | + |
| 22 | +.Prerequisites |
| 23 | + |
| 24 | +* You have a valid TLS certificate that covers the DNS name that you will set in the `kubeAPIServerDNSName` field. |
| 25 | +* Your DNS name is a resolvable URI that is reachable and pointing to the right address. |
| 26 | +
|
| 27 | +.Procedure |
| 28 | + |
| 29 | +* In the specification for the `HostedCluster` object, add the `kubeAPIServerDNSName` field and the address for the domain and specify which certificate to use, as shown in the following example: |
| 30 | ++ |
| 31 | +[source,yaml] |
| 32 | +---- |
| 33 | +#... |
| 34 | +spec: |
| 35 | + configuration: |
| 36 | + apiServer: |
| 37 | + servingCerts: |
| 38 | + namedCertificates: |
| 39 | + - names: |
| 40 | + - xxx.example.com |
| 41 | + - yyy.example.com |
| 42 | + servingCertificate: |
| 43 | + name: <my_serving_certificate> |
| 44 | + kubeAPIServerDNSName: <your_custom_address> # <1> |
| 45 | +---- |
| 46 | ++ |
| 47 | +<1> The value for the `kubeAPIServerDNSName` field must be a valid, addressable domain. |
| 48 | +
|
| 49 | +After you define the `kubeAPIServerDNSName` field and specify the certificate, the Control Plane Operator controllers create a `kubeconfig` file named `custom-admin-kubeconfig`, which is stored in the `HostedControlPlane` namespace. The certificates are generated from the root CA, and the `HostedControlPlane` namespace manages their expiration and renewal. |
| 50 | + |
| 51 | +The Control Plane Operator reports a new `kubeconfig` file named `CustomKubeconfig` in the `HostedControlPlane` namespace. That file uses the new server that is defined in the `kubeAPIServerDNSName` field. |
| 52 | + |
| 53 | +The custom `kubeconfig` file is referenced in the `HostedCluster` object in the `status` field as `CustomKubeconfig`. The `CustomKubeConfig` field is optional, and can be added only if the `kubeAPIServerDNSName` field is not empty. When the `CustomKubeConfig` field is set, it triggers the generation of a secret named `<hosted_cluster_name>-custom-admin-kubeconfig` in the `HostedCluster` namespace. You can use the secret to access the `HostedCluster` API server. If you remove the `CustomKubeConfig` field during day-2 operations, all related secrets and status references are deleted. |
| 54 | + |
| 55 | +[NOTE] |
| 56 | +==== |
| 57 | +This process does not directly affect the data plane, so no rollouts are expected to occur. The `HostedControlPlane` namespace receives the changes from the HyperShift Operator and deletes the corresponding fields. |
| 58 | +==== |
| 59 | + |
| 60 | +If you remove the `kubeAPIServerDNSName` field from the specification, all newly generated secrets and the `CustomKubeconfig` reference are removed from the cluster and from the `status` field. |
0 commit comments