Under the cloud-native trend, containers and Kubernetes are household names, and many R&D teams within enterprises are using Kubernetes to build DevOps platforms. From the earliest container concept to Kubernetes to DevOps/GitOps, the entire technology chain is very large, and the advantages of Kubernetes are also obvious 可移动 可扩展 自修复 The point is that the technical threshold is too high. For developers, Kubernetes alone is enough for us to learn for a while.

Usually, when we deploy applications in Kubernetes, we need to use Dockerfile to image the business, and then write Kubernetes' Yaml deployment application, and then combine Jenkins' Pipeline to implement CI/CD. For developers who do not understand containers, it is a bit expensive to learn Dockerfile syntax, K8s Yaml syntax, and Jenkins Pipeline syntax. "I want Coding too!"

This article will introduce how to deploy applications in Kubernetes and how to deploy applications in Rainbond.

Deploy applications in Kubernetes

Deploy an Nginx in Kubernetes and access it via NodePort and via Ingress.

  1. CREATE nginx-deployment.yaml
 apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80
  1. Create nginx-service.yaml and set the Service type to NodePort
 apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: NodePort
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
      nodePort: 30080
  1. Create Nginx Deployment and Nginx Service
 $ kubectl apply -f nginx-deployment.yaml
$ kubectl apply -f nginx-service.yaml
  1. Create an Ingress Policy
 apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx-example
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx-service
            port:
              number: 80
 kubectl apply -f nginx-ingress.yaml

The above is a simple example of deploying an Nginx in Kubernetes and enabling Nodeport access and Ingress access. This process requires an understanding of the K8s resource type, Deployment Service Ingress, and how resource types are bound together. This is just the tip of the iceberg. For complex businesses, it is necessary to write multiple such Yamls and clarify the dependencies between businesses.

Deploy the application in Rainbond

Rainbond is a cloud-native application management platform built on Kubernetes. It follows the application-centric concept. Its purpose is to allow users to easily deploy their business in Kubernetes without writing complex Yaml files.

Install Rainbond Allinone with one command.

Here is also a Nginx deployed and accessed via NodePort and via Ingress.

  1. To deploy the Nginx application, in the Rainbond team view -> select the component based on image creation -> select the image address nginx:latest to create it.

  1. Open Ingress access, in Nginx component -> port -> open external service, an accessible domain name will be generated by default.

  1. Enable Nodeport access, in the application view -> Gateway -> TCP/UDP -> Add Policy One-click binding to the TCP access policy.

Deploying applications on Rainbond only requires a little bit to understand some concepts of Rainbond, with zero learning cost. Some concepts of Rainbond mentioned in the article:

Components: Components correspond to controllers in K8s, such as Deployment, Statefulset, etc.

Application: An application is an application composed of multiple components, which is called an application by including multiple components through a set of microservices.

Gateway: The gateway is the entrance of Rainbond's external access. The domain name and Tcp access are all access policies generated by the gateway.

There are also some concepts not mentioned in the text, such as:

Team: Rainbond's team is assigned to departments, such as development department and testing department. In fact, the team at the bottom corresponds to K8s NameSpace.

at last

Deploying applications in Kubernetes requires us to learn a lot about containers, Kubernetes concepts, Yaml syntax, and more. To deploy applications on Rainbond, you only need to click on the UI interface to complete the deployment, which is very friendly to students who do not understand K8s and containers, and can quickly deploy their own business.


Rainbond
764 声望56 粉丝

不用懂 Kubernetes 的云原生应用管理平台