Enable an Application per Cluster
Prerequisites
Ensure you have reviewed the prerequisites section.
Enable an Application per Cluster for the First Time
When you enable an application on a workspace, it is deployed to all clusters in the workspace by default. If you would like to only deploy it to a subset of clusters when enabling it on a workspace for the first time, you can follow the steps below:
Create an
AppDeployment
for your application, selecting a subset of clusters within the workspace to enable it on. You can use thedkp get clusters --workspace ${WORKSPACE_NAME}
command to see the list of clusters in the workspace.
The following snippet is an example. Replace the application name, version, workspace name and cluster names according to your requirements. See Components and Applications for compatible versions.BASHdkp create appdeployment kube-prometheus-stack --app kube-prometheus-stack-46.8.1 --workspace ${WORKSPACE_NAME} --clusters attached-cluster1,attached-cluster2
Optional: Check the current status of the
AppDeployment
to see the names of the clusters where the application is currently enabled.
Enable or Disable an Application per Cluster after it has been enabled at the workspace level
You can enable or disable applications at any time. After you have enabled the application at the workspace level, the spec.clusterSelector
field populates.
For clusters that are newly attached into the workspace, all applications enabled for the workspace are automatically enabled on and deployed to the new clusters.
If you want to see on what clusters your application is currently deployed, refer to the Print and Review the Current State of your AppDeployment documentation.
Edit the
AppDeployment
YAML by adding or removing the names of the clusters where you want to enable your application in theclusterSelector
section:The following snippet is an example. Replace the application name, version, workspace name and cluster names according to your requirements. See Components and Applications for the compatible versions.
YAMLcat <<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.1 kind: ClusterApp clusterSelector: matchExpressions: - key: kommander.d2iq.io/cluster-name operator: In values: - attached-cluster1 - attached-cluster3-new EOF
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.