Deploying your application to StarlingX

This article was published for StarlingX you can view original here.

Deploying your own application to StarlingX is as easy as in any other Kubernetes deployment out there. In this blog post I will show you the process with a simple demo app.<!- more ->

It's important to understand that an application can be deployed in many ways on the Kubernetes cluster(s) that StarlingX manages :

In this article I will focus on Helm, which is the most popular package manager for Kubernetes. Future blog posts will address other deployment types and their characteristics.

I will use a virtual All-In-One Simplex (AIO-SX) setup of StarlingX. If you want to follow along, you can install your own by following the related StarlingX install guide.

Anyone who already packages their application with Helm will be able to deploy it on StarlingX without additional hassle.

 

The Demo App

I will use a simple demo app for this blog post, which simulates tasks, like antivirus scanning and threat monitoring. If you would like to learn more about the app and use it to follow the below deployment steps, please check out the documentation and source in the app's GitHub repo.

 

Deploying the Demo App

Via a Helm Package file

You can simply use the packaged Helm chart from your own source code, and use the Helm CLI to install the package.

Package the Helm chart

The following commands will checkout the demo app, cd into the downloaded source code and finally use helm to generate a Helm chart file.

git clone https://github.com/brunomuniz-encora/poc-starlingx-messages.git

cd poc-starlingx-messages
helm package helm-chart/

The poc-starlingx-<version>.tgz file can be found on the root folder of the downloaded repo:

...
Successfully packaged chart and saved it to: .../poc-starlingx-messages/poc-starlingx-1.5.2.tgz

Install the Helm package directly on StarlingX

Once the package is made available on a StarlingX instance, the below command will deploy the application to the StarlingX-managed Kubernetes cluster:

helm install poc-starlingx-messages-node poc-starlingx-1.5.2.tgz

This is the expected output:

NAME: poc-starlingx-messages
LAST DEPLOYED: <date> <time>
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
[sysadmin@controller-0 ~(keystone_admin)]$ 

This is the stage when you can log into your application and configure it, in order to have it fully functional. The demo app I use does not require any additional setup and is currently up and running. You can verify this by using the kubectl get all command, which should provide the output below:

sysadmin@controller-0:~$ kubectl get all
NAME                                       READY   STATUS    RESTARTS   AGE
pod/poc-starlingx-85d766894b-dmw4v         1/1     Running   0          40s

NAME                           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
service/poc-starlingx          NodePort    10.97.156.62    <none>        8100:31234/TCP   40s

NAME                                   READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/poc-starlingx          1/1     1            1           40s

NAME                                             DESIRED   CURRENT   READY   AGE
replicaset.apps/poc-starlingx-85d766894b         1         1         1       40s

You can also use helm list and other Helm commands to check the status of the deployment:

 

sysadmin@controller-0:~$ helm list
NAME                    NAMESPACE       REVISION        UPDATED         STATUS     CHART                            APP VERSION
poc-starlingx-messages  default         1               <date> <time>   deployed   poc-starlingx-1.5.2              1.5.2
[sysadmin@controller-0 ~(keystone_admin)]$

Modify the app configuration via Helm

Of course, applications might (and should) be configurable through the environment where they are running on. The demo app is no different and exposes several configuration options via Helm values.

The demo application has multiple components which are deployed as multiple instances that are configured differently. One of these components is called central, which I will deploy now by creating a user-supplied values file that will override a few default values:

cat <<EOF > central-overrides.yml
env:
  # Set application to act as a `central`
  - name: MODE
    value: central

kube:
  # Set the NodePort to be configured within the Kubernetes Service resource
  port: 32767
  # Set a different name for the Kubernetes resources (helper to allow multiple instances run in the same cluster)
  name: poc-starlingx-central

EOF

Now I will use the central-overrides.yml file, that I just created, to deploy a new version of the application with the command:

helm install -f central-overrides.yml poc-starlingx-messages-central poc-starlingx-1.5.2.tgz

This is the expected output:

NAME: poc-starlingx-messages-central
LAST DEPLOYED: <date> <time>
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None

Again, the app is readily available in the Kubernetes cluster:

sysadmin@controller-0:~$ kubectl get all
NAME                                         READY   STATUS    RESTARTS   AGE
pod/poc-starlingx-85d766894b-dmw4v           1/1     Running   0          3h51m
pod/poc-starlingx-central-5588f46ccb-2s8g2   1/1     Running   0          38s

NAME                            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
service/poc-starlingx           NodePort    10.97.156.62    <none>        8100:31234/TCP   3h51m
service/poc-starlingx-central   NodePort    10.103.215.65   <none>        8100:32767/TCP   38s

NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/poc-starlingx           1/1     1            1           3h51m
deployment.apps/poc-starlingx-central   1/1     1            1           38s

NAME                                               DESIRED   CURRENT   READY   AGE
replicaset.apps/poc-starlingx-85d766894b           1         1         1       3h51m
replicaset.apps/poc-starlingx-central-5588f46ccb   1         1         1       38s

[sysadmin@controller-0 ~(keystone_admin)]$ helm list
NAME                            NAMESPACE       REVISION        UPDATED                                 STATUS   CHART                           APP VERSION
poc-starlingx-messages          default         1               2023-10-02 19:54:09.609324422 +0000 UTC deployed poc-starlingx-1.5.2             1.5.2
poc-starlingx-messages-central  default         1               2023-10-02 23:45:23.724816272 +0000 UTC deployed poc-starlingx-1.5.2             1.5.2

 

Via a Helm repository

Of course, you can make it even easier to deploy an application by using a Helm charts repository. To demonstrate this, I will deploy a different app, the Kubernetes dashboard application, which is distributed under a public chart repository. You can add this application to StarlingX by following the steps below :

helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/

And then use it to install the Kubernetes Dashboard:

cat <<EOF >dashboard-values.yaml
service:
  type: NodePort
  nodePort: 32000

rbac:
  create: true
  clusterAdminRole: true

serviceAccount:
  create: true
  name: kubernetes-dashboard

EOF
helm install kubernetes-dashboard \
 kubernetes-dashboard/kubernetes-dashboard \
 -f dashboard-values.yaml \
 --version 6.0.8

These instructions are based on the Kubernetes Dashboard official installation guide. The automated virtual installation installs and sets up the Kubernetes Dashboard for you. The procedure is also covered on the bare metal installation guides.

Conclusion

In less than 5 minutes you learned how easy it is to deploy your existing Helm-packaged application to StarlingX. No surprises there!

This is what the StarlingX cluster looks like after everything that I covered: on this blog post:

sysadmin@controller-0:~$ kubectl get all
NAME                                         READY   STATUS    RESTARTS   AGE
pod/kubernetes-dashboard-d4df5796b-km2jh     1/1     Running   0          6h43m
pod/poc-starlingx-7775bb7864-sf544           1/1     Running   0          46m
pod/poc-starlingx-central-5588f46ccb-2s8g2   1/1     Running   0          100m

NAME                            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
service/kubernetes              ClusterIP   10.96.0.1       <none>        443/TCP          7h16m
service/kubernetes-dashboard    NodePort    10.111.41.251   <none>        443:32000/TCP    6h43m
service/poc-starlingx           NodePort    10.97.156.62    <none>        8100:31234/TCP   5h32m
service/poc-starlingx-central   NodePort    10.103.215.65   <none>        8100:32767/TCP   100m

NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/kubernetes-dashboard    1/1     1            1           6h43m
deployment.apps/poc-starlingx           1/1     1            1           5h32m
deployment.apps/poc-starlingx-central   1/1     1            1           100m

NAME                                               DESIRED   CURRENT   READY   AGE
replicaset.apps/kubernetes-dashboard-d4df5796b     1         1         1       6h43m
replicaset.apps/poc-starlingx-7775bb7864           1         1         1       46m
replicaset.apps/poc-starlingx-central-5588f46ccb   1         1         1       100m

We will talk about Flux and StarlingX Apps in the next installments of this series.

 

About StarlingX

If you would like to learn more about the project and get involved check the website for more information or download the code and start to experiment with the platform. If you are already evaluating or using the software please fill out the user survey and help the community improve the project based on your feedback.

Learn More about Encora

We are the software development company fiercely committed and uniquely equipped to enable companies to do what they can’t do now.

Learn More

Global Delivery

READ MORE

Careers

READ MORE

Industries

READ MORE

Related Insights

Making Dynamic Pricing Truly Dynamic – Win-win Approach for Customers and Retailers

Dynamic Pricing has become a go-to strategy to compete and improve the bottom line.

Read More

Generative AI: Transforming the Insurance Industry

Learn how generative AI transforms insurance via underwriting, claims processing, and customer ...

Read More

Adopting a Cloud Cost Management Culture: 4 Best Practices to Consider

What is cloud cost management? Learn best practices and get tips to navigate the complexities ...

Read More
Previous Previous
Next

Accelerate Your Path
to Market Leadership 

Encora logo

+1 (480) 991 3635

letstalk@encora.com

Innovation Acceleration

Encora logo

+1 (480) 991 3635

letstalk@encora.com

Innovation Acceleration