×
Community Blog Manage Kubernetes Applications without Writing YAML

Manage Kubernetes Applications without Writing YAML

This article explains how to simplify Kubernetes management using application models and their practical significance.

By Rainbond

Kubernetes abstracts everything within its boundaries as resources. The main resources are the workload controllers (such as Deployment and StatefulSet). Other types of resources work around these main resources. A workload-centric model for IT technicians can be implemented by combining these resources. All resources in Kubernetes are edited and described using declarative configuration files. YAML field definitions give IT technicians the greatest freedom but place high demands on their skills.

Simplify Kubernetes Management Using Application Models

If your team has been using native Kubernetes for some time, you'll probably find that not every IT technician is good at writing complex Kubernetes declarative configuration files - YAML files. Learning and writing YAML will be a burden for developers whose main responsibility is business development, and they may even resist using it.

Rainbond, an open-source project, is a cloud-native application management platform that uses an application-centric design pattern. Based on this design pattern, Rainbond abstracts application models at a higher level than workload. You can manage the entire lifecycle of business applications without learning and writing YAML. The application corresponds to a complete business system, which consists of several service components that can be separately managed. You can deploy a business component by editing the service call relationship by dragging, pulling, and dropping operations from the source code and container images. For each service component, you can use some common O&M features based on the graphical user interface. On this basis, users can also use the core concept of the application model to make more advanced operations (such as publishing the entire business system in the form of an application template), based on which the business system can be deployed/upgraded with one click. This capability is useful in the area of software delivery. It allows for rapid delivery and personalized delivery based on the application template, regardless of whether the final delivery environment is online or offline.

1
The application model provided by Rainbond enables developers to focus on the application and the business, so it is accepted easier. The O&M features retained after tailoring are displayed and interactive through the graphical user interface, which significantly reduces the difficulty of use. Most developers can use Kubernetes smoothly through application templates without editing complex declarative configuration files.

Convert Kubernetes YAML to an Application Model

The entire conversion process includes three steps:

  1. For the most common workload, you can automatically generate it from source code and container images or import existing YAML and running applications. The import process automatically identifies all convertible workload resources, including Deployment, StatefulSet, Job, and CronJob. These resources will be converted into application models and run as service components after conversion.
  2. After you import the generated service components, you can view and edit basic workload attributes (such as environment variables and image addresses). The identified advanced workload attributes are added to service components during the conversion process. These attributes are viewed and managed in the form of Key/Value or YAML.
  3. Non-workload resources (such as Secret, ServiceAccount, and Role) are classified and loaded to the Kubernetes resources page of the application interface for operators to edit in an interactive way.

Advanced workload attributes that can be managed and converted include:

Attribute Name Description
nodeSelector It is used when you specify a type of node for scheduling.
labels It is used when you customize labels of service components to be used by node selectors.
volumes It is used to define mounts of volume type that are not managed by Rainbond.
volumeMounts It works with volumes to mount volumes to containers.
affinity It is a more advanced scheduling method, including node affinity and pod affinity.
tolerations It works with node taints. Only pods with the specified tolerations can be scheduled to the specified node.
serviceAccountName It is used to specify an existing SA for the service component so that the corresponding pod has certain permissions.
privileged Don't enable it if it's not necessary.
env It is used to define environment variables that are not managed by Rainbond, and it supports reference operations.

It is worth noting that the extended RAM model can still be published as an application template for subsequent installation, upgrade, and delivery of the entire business system with one click.

Tests and Practices of Importing Existing Kubernetes Applications

The following test is based on Rainbond V5.8. I plan to use WordPress, a website building system that has been deployed in the wp namespace, to perform an import test (and test the import of existing Kubernetes applications). The system consists of the following resources:

[root@localhost ~]# kubectl get secret,service,deployment,statefulset,pod -n wp
NAME                         TYPE                                  DATA   AGE
secret/default-token-nq5rs   kubernetes.io/service-account-token   3      27m
secret/mysql-secret          Opaque                                2      27m
NAME                TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
service/wordpress   NodePort    10.43.157.40    <none>        8080:30001/TCP   5m19s
service/wp-mysql    ClusterIP   10.43.132.223   <none>        3306/TCP         27m
NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/wordpress   1/1     1            1           5m19s
NAME                        READY   AGE
statefulset.apps/wp-mysql   1/1     27m
NAME                             READY   STATUS    RESTARTS   AGE
pod/wordpress-66bc999449-qv97v   1/1     Running   0          5m19s
pod/wp-mysql-0                   1/1     Running   0          27m

Visit Rainbond and choose Import from the Cluster drop-down list. On the page that appears, you can select the namespace wp to which you want to import resources. The platform will group resources by label:

2
Rainbond divides applications based on the defined labels on resources. For example, resources with the label app.kubernetes.io/name:wp-mysql or app:wordpress are distributed to two different applications in the figure, while resources without the above labels are uniformly distributed into an ungrouped application. Dividing applications is critical because the advanced application of the application model is for an application as a whole, so it is important to plan carefully and add reasonable labels before importing.

During importing, Rainbond submits different attributes to the extended model for management. Most O&M features have become easy to use, while others are managed by the Kubernetes attributes page.

3
Once the import is complete, both wordpress and wp-mysql can be managed on Rainbond.

  • Port Management

Before being imported, WordPress is exposed based on the NodePort Service, but after being imported to Rainbond for management, it uses a gateway to expose port 80 to the outside world. Note: You must restart the WordPress service component for the access policy to take effect.

4

For some services, the access portal does not support dynamic designation, which requires the service side to make some changes to adapt to the new access portal. For WordPress, the site address in the general options needs to be redefined.

5

  • Storage Management

The WordPress system I deployed uses the hostpath mode for the storage of all components. Although this configuration is simple, it is not suitable for large-scale Kubernetes environments where pods may drift. After Rainbond is deployed, it provides easy-to-use shared storage that supports data sharing among multiple pods and across-host migration of pods. The original hostpath storage can be redefined. The redefined storage path will become empty, so remember to find a different path to perform data migration.

6

Practical Significance

Application models allow IT technicians to focus more on the business rather than underlying complex tools. The final effect is to reduce the operation costs and difficulty in understanding, making Kubernetes easier to be implemented.

1 2 1
Share on

Alibaba Cloud Community

875 posts | 198 followers

You may also like

Comments

Dikky Ryan Pratama July 5, 2023 at 6:12 am

awesome!

Alibaba Cloud Community

875 posts | 198 followers

Related Products