Skip to main content
Skip table of contents

Customize an Application per Cluster

These pages refer to DKP Enterprise and DKP Gov Advanced products.

Prerequisites

Ensure you have reviewed the prerequisites section.

Enable a Custom Configuration of an Application for a Cluster

You can customize the application for each cluster occurrence of said application. If you want to customize the application for a cluster that is not yet attached, refer to the instructions below, so the application is deployed with the custom configuration during attachment.
To enable per-cluster customizations:

  1. Reference the name of the ConfigMap to be applied per cluster in the spec.clusterConfigOverrides fields. In this example, you have three different customizations specified in three different ConfigMaps for three different clusters in one workspace:

    YAML
    cat <<EOF | kubectl apply -f -
    apiVersion: apps.kommander.d2iq.io/v1alpha3
    kind: AppDeployment
    metadata:
      name: kube-prometheus-stack
      namespace: ${WORKSPACE_NAMESPACE}
    spec:
      appRef:
        name: kube-prometheus-stack-46.8.0
        kind: ClusterApp
      clusterSelector:
        matchExpressions:
        - key: kommander.d2iq.io/cluster-name
          operator: In
          values:
          - attached-cluster1
          - attached-cluster2
          - attached-cluster3-new
      clusterConfigOverrides:
        - configMapName: kps-cluster1-overrides
          clusterSelector:
            matchExpressions:
            - key: kommander.d2iq.io/cluster-name
              operator: In
              values:
              - attached-cluster1
        - configMapName: kps-cluster2-overrides
          clusterSelector:
            matchExpressions:
            - key: kommander.d2iq.io/cluster-name
              operator: In
              values:
              - attached-cluster2
        - configMapName: kps-cluster3-overrides
          clusterSelector:
            matchExpressions:
            - key: kommander.d2iq.io/cluster-name
              operator: In
              values:
              - attached-cluster3-new
    EOF
  2. If you have not done so yet, create the ConfigMaps referenced in each clusterConfigOverrides entry.

  • The changes are applied only if the YAML file has a valid syntax.

  • Set up only one cluster override ConfigMap per cluster. If there are several ConfigMaps configured for a cluster, only one will be applied.

  • Cluster override ConfigMaps must be created on the Management cluster.

Enable a Custom Configuration of an Application for a Cluster at Attachment

You can customize the application configuration for a cluster prior to its attachment, so that the application is deployed with this custom configuration on attachment. This is preferable, if you do not want to redeploy the application with an updated configuration after it has been initially installed, which may cause downtime.

To enable per-cluster customizations, follow these steps before attaching the cluster:

  1. Set the CLUSTER_NAME environment variable to the cluster name that you will give your to-be-attached cluster:

    CODE
    export CLUSTER_NAME=<your_attached_cluster_name>
  2. Reference the name of the ConfigMap you want to apply to this cluster in the spec.clusterConfigOverrides fields. You do not need to update the spec.clusterSelector field. In this example, you have the kps-cluster1-overrides customization specified for attached-cluster-1 and a different customization (in kps-your-attached-cluster-overrides ConfigMap) for your to-be-attached cluster:

    YAML
    cat <<EOF | kubectl apply -f -
    apiVersion: apps.kommander.d2iq.io/v1alpha3
    kind: AppDeployment
    metadata:
      name: kube-prometheus-stack
      namespace: ${WORKSPACE_NAMESPACE}
    spec:
      appRef:
        name: kube-prometheus-stack-46.8.0
        kind: ClusterApp
      clusterSelector:
        matchExpressions:
        - key: kommander.d2iq.io/cluster-name
          operator: In
          values:
          - attached-cluster1
      clusterConfigOverrides:
        - configMapName: kps-cluster1-overrides
          clusterSelector:
            matchExpressions:
            - key: kommander.d2iq.io/cluster-name
              operator: In
              values:
              - attached-cluster1
        - configMapName: kps-your-attached-cluster-overrides
          clusterSelector:
            matchExpressions:
            - key: kommander.d2iq.io/cluster-name
              operator: In
              values:
              - ${CLUSTER_NAME}
    EOF
  3. If you have not done so yet, create the ConfigMap referenced for your to-be-attached cluster.

  • The changes are applied only if the YAML file has a valid syntax.

  • Cluster override ConfigMaps must be created on the Management cluster.

Verify the Current Configuration of your Application

Refer to the Verify applications help to connect to the managed or attached cluster and check the status of the deployments. 

If you want to know how the AppDeployment resource is currently configured, refer to the Print and review the state of your AppDeployment section.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.