Configuring a custom PKI

    You can leverage the Proxy API to add cluster-wide trusted CA certificates. You must do this either during installation or at runtime.

    • During installation, configure the cluster-wide proxy. You must define your privately signed CA certificates in the file’s additionalTrustBundle setting.

      The installation program generates a ConfigMap that is named user-ca-bundle that contains the additional CA certificates you defined. The Cluster Network Operator then creates a trusted-ca-bundle ConfigMap that merges these CA certificates with the Fedora CoreOS (FCOS) trust bundle; this ConfigMap is referenced in the Proxy object’s trustedCA field.

    • At runtime, (part of cluster’s proxy enablement workflow). This involves creating a ConfigMap that contains the privately signed CA certificates that should be trusted by the cluster, and then modifying the proxy resource with the trustedCA referencing the privately signed certificates’ ConfigMap.

    Production environments can deny direct access to the internet and instead have an HTTP or HTTPS proxy available. You can configure a new OKD cluster to use a proxy by configuring the proxy settings in the install-config.yaml file.

    Prerequisites

    • You have an existing install-config.yaml file.

    • You reviewed the sites that your cluster requires access to and determined whether any of them need to bypass the proxy. By default, all cluster egress traffic is proxied, including calls to hosting cloud provider APIs. You added sites to the Proxy object’s spec.noProxy field to bypass the proxy if necessary.

      The Proxy object status.noProxy field is populated with the values of the networking.machineNetwork[].cidr, networking.clusterNetwork[].cidr, and networking.serviceNetwork[] fields from your installation configuration.

      For installations on Amazon Web Services (AWS), Google Cloud Platform (GCP), Microsoft Azure, and OpenStack, the Proxy object status.noProxy field is also populated with the instance metadata endpoint (169.254.169.254).

    Procedure

    1. 1A proxy URL to use for creating HTTP connections outside the cluster. The URL scheme must be http.
      2A proxy URL to use for creating HTTPS connections outside the cluster.
      3A comma-separated list of destination domain names, IP addresses, or other network CIDRs to exclude from proxying. Preface a domain with . to match subdomains only. For example, .y.com matches x.y.com, but not y.com. Use * to bypass the proxy for all destinations.
      4If provided, the installation program generates a config map that is named user-ca-bundle in the openshift-config namespace that contains one or more additional CA certificates that are required for proxying HTTPS connections. The Cluster Network Operator then creates a trusted-ca-bundle config map that merges these contents with the Fedora CoreOS (FCOS) trust bundle, and this config map is referenced in the trustedCA field of the Proxy object. The additionalTrustBundle field is required unless the proxy’s identity certificate is signed by an authority from the FCOS trust bundle.
      5Optional: The policy to determine the configuration of the Proxy object to reference the user-ca-bundle config map in the field. The allowed values are Proxyonly and Always. Use Proxyonly to reference the user-ca-bundle config map only when http/https proxy is configured. Use Always to always reference the user-ca-bundle config map. The default value is Proxyonly.

      The installation program does not support the proxy readinessEndpoints field.

    2. Save the file and reference it when installing OKD.

    The installation program creates a cluster-wide proxy that is named cluster that uses the proxy settings in the provided install-config.yaml file. If no proxy settings are provided, a cluster Proxy object is still created, but it will have a nil spec.

    Only the Proxy object named cluster is supported, and no additional proxies can be created.

    The Proxy object is used to manage the cluster-wide egress proxy. When a cluster is installed or upgraded without the proxy configured, a Proxy object is still generated but it will have a nil spec. For example:

    1. apiVersion: config.openshift.io/v1
    2. metadata:
    3. name: cluster
    4. spec:
    5. trustedCA:
    6. name: ""
    7. status:

    A cluster administrator can configure the proxy for OKD by modifying this cluster Proxy object.

    Only the Proxy object named cluster is supported, and no additional proxies can be created.

    Prerequisites

    • Cluster administrator permissions

    • OKD oc CLI tool installed

    Procedure

    1. Create a config map that contains any additional CA certificates required for proxying HTTPS connections.

      1. Create a file called user-ca-bundle.yaml with the following contents, and provide the values of your PEM-encoded certificates:

      2. Create the config map from this file:

      3. Use the oc edit command to modify the Proxy object:

        1. $ oc edit proxy/cluster
      4. Configure the necessary fields for the proxy:

        1A proxy URL to use for creating HTTP connections outside the cluster. The URL scheme must be http.
        2A proxy URL to use for creating HTTPS connections outside the cluster. The URL scheme must be either http or https. Specify a URL for the proxy that supports the URL scheme. For example, most proxies will report an error if they are configured to use https but they only support http. This failure message may not propagate to the logs and can appear to be a network connection failure instead. If using a proxy that listens for https connections from the cluster, you may need to configure the cluster to accept the CAs and certificates that the proxy uses.
        3A comma-separated list of destination domain names, domains, IP addresses or other network CIDRs to exclude proxying.

        Preface a domain with . to match subdomains only. For example, .y.com matches x.y.com, but not y.com. Use * to bypass proxy for all destinations. If you scale up workers that are not included in the network defined by the networking.machineNetwork[].cidr field from the installation configuration, you must add them to this list to prevent connection issues.

        This field is ignored if neither the httpProxy or httpsProxy fields are set.

        4One or more URLs external to the cluster to use to perform a readiness check before writing the httpProxy and httpsProxy values to status.
        5A reference to the config map in the openshift-config namespace that contains additional CA certificates required for proxying HTTPS connections. Note that the config map must already exist before referencing it here. This field is required unless the proxy’s identity certificate is signed by an authority from the RHCOS trust bundle.
      5. Save the file to apply the changes.

      Once your custom CA certificate is added to the cluster via ConfigMap, the Cluster Network Operator merges the user-provided and system CA certificates into a single bundle and injects the merged bundle into the Operator requesting the trust bundle injection.

      After adding a config.openshift.io/inject-trusted-cabundle=”true” label to the config map, existing data in it is deleted. The Cluster Network Operator takes ownership of a config map and only accepts ca-bundle as data. You must use a separate config map to store service-ca.crt by using the service.beta.openshift.io/inject-cabundle=true annotation or a similar configuration. Adding a config.openshift.io/inject-trusted-cabundle=”true” label and service.beta.openshift.io/inject-cabundle=true annotation on the same config map can cause issues.

      Operators request this injection by creating an empty ConfigMap with the following label:

      1. config.openshift.io/inject-trusted-cabundle="true"

      An example of the empty ConfigMap:

      1. apiVersion: v1
      2. data: {}
      3. kind: ConfigMap
      4. metadata:
      5. labels:
      6. config.openshift.io/inject-trusted-cabundle: "true"
      7. namespace: apache
      1Specifies the empty ConfigMap name.

      The Operator mounts this ConfigMap into the container’s local trust store.

      The ConfigMap can reside in any namespace, but the ConfigMap must be mounted as a volume to each container within a pod that requires a custom CA. For example:

      1ca-bundle.crt is required as the ConfigMap key.
      2tls-ca-bundle.pem is required as the ConfigMap path.