Deploy Applications on Managed Kubernetes Clusters#
Using RedHat ACM (RHACM)#
This document will describe the steps necessary to: - Provisioning a K3s on an existing VM - Attaching a K3s cluster to a RHACM instance - Deploying an application on the RHACM instance - The application we’ll use is sktime - Having the RHACM cluster propagate and deploy the application to the connected Managed-Cluster - Via placements and label management Accessing the application
Requirements: - Access to a RHACM instance - Access to a VM that can run K3s
Attaching K3s cluster to RHACM#
Refer to attach-cluster’s README for automated attaching script
Steps taken from importing-a-target-managed-cluster-to-the-hub-cluster
The K3s cluster must be able to connect to the RHACM instance in order to be imported
Open the ACM UI
Open Infrastracture -> Clusters (path ACM-URL/multicloud/clusters)
Click Import Cluster
Enter a cluster name (it is recommended that your choice is expressive of the cluster)
Click “Save import and generate code”
Copy the command generated and run it on your K3s cluster
The imported cluster should appear as “Ready” under Infrastracture -> Clusters within minutes
Getting the application deployed on a Managed-Cluster#
The above application is bounded to a placementrule that selects managed-clusters with label env=lrt
. To add the label to your managed-clusters, visit Infrastructure/Clusters in the ACM UI, or run:
kubectl label managedcluster <cluster-name> env=lrt
Additional information#
A k3s cluster can be used only on linux, in order to use a k3s cluster on a different os, one would have to use k3d which runs a k3s on a container, reference for k3d: https://k3d.io/v5.4.1/
In order to open bash on a pod use kubectl
kubectl exec -it <pod-name> -n <pod-namespace> -- bash