Rancher is known for its capability to manage kubernetes clusters, be they on public platforms such as GKE, EKS, AKS or Rancher’s offering, RKE. Additional project concepts, role based access controls, monitoring and logging are there to group and make concrete administrative tasks for each cluster. The idea is taken another step further to provide an app store-like space, Apps, where k8s applications that are readily-made can be added to this space via managing catalogs settings.
Image Source : Bigstack CubeOS
Actions here are still straightforward, we go find a public repository where the apps are packaged and consumable by our cluster. By adding them to catalog URL, we will be able to find the published app in the Apps -> Launch page. There we can see dozens of popular k8s apps that people find handy in day to day use.
Image Source : Bigstack CubeOS
All these so far are good but still not the end of story because those who embraced open projects such as rancher, k8s, docker, etc. would sooner or later also go for customized apps that can be 100% self-hosted and managed.
How one can publish his own app into a self-hosted Rancher system?
Inside a Rancher app is a number of files such as descriptions, icon images, yaml files, configurations, etc. All together they define in detail how an app is to be deployed. The structure of this app package needs to conform to an understandable format for k8s. Such package is referred to as chart and a chart can be consumed by k8s package manager, helm. The app, before it is launched, needs to live somewhere which we can access by adding an URL in apps catalog as illustrated above. This place is called a chart repository; it is an http server with certain directory/file arrangements such that rancher client can query the contents in index.html and download charts accordingly. As an example of running a popular ChartMuseum repo in our Rancher k8s cluster.
$ helm repo add chartmuseum https://chartmuseum.github.io/charts
$ helm fetch chartmuseum/chartmuseum --version 3.6.2
$ helm --kubeconfig $KUBECONFIG upgrade --install chartmuseum chartmuseum-*.tgz -n chartmuseum --create-namespace --wait --wait-for-jobs -f chartmuseum-values.yaml
With these we have a chartmuseum repo. pod running. Depending on the private IP and port, the URL can be added although there is not yet any chart yet. After creating our own chart, let’s push it into our empty chartmuseum repository.
$ curl --data-binary @${CM_CHART_FILE} ${URL}/api/charts
Upon refreshing the apps category, we get our home-baked app freshly advertised on Rancher k8s app store:
Image Source : Bigstack CubeOS