Kubevela starts | making cloud application delivery more smooth

Time:2021-9-17

Introduction:Kubevela is the technical implementation of OAM (open application model) standard jointly initiated by Alibaba cloud and Microsoft. It aims to create a unified, standard and cross environment cloud application delivery, which is time-saving, labor-saving, easy and simple

Author Kube Vela community

Author Kube Vela community

This article is suitable for all software engineers, especially front-end, mobile and full stack engineers who want to expand their vision of back-end technology.

preface

In today’s increasingly agile software development, the back-end technology architecture has been evolving all the time to adapt to the changes of requirements.

From the initial era of physical machine, the era of virtual machine in the bud of cloud computing, and then to the era of container, all these things have developed in a certain direction, that is, to make application delivery better, faster and stronger. At present, in the container era, we have to face these troubles while meeting the rich capabilities brought by the wave of cloud native technologies such as kubernetes:

  • Kubernetes’ steep learning curve and a bunch of dazzling concepts make the development efficiency of application developers difficult to be satisfactory.
  • The platform team of service application development does not have a suitable framework to build user-friendly and highly extensible abstractions.
  • Especially in the increasingly complex business scenarios of hybrid cloud, multi cloud and distributed cloud in the future, application delivery will become fragmented.

Kubevela is the technical implementation of OAM (open application model) standard jointly initiated by Alibaba cloud and Microsoft. It aims to create a unified, standard and cross environment cloud application delivery, which is time-saving, labor-saving, easy and simple:

  • Application centric – kubevela introduces the open application model (OAM) as a higher-level API to capture all the information of microservice delivery for hybrid environment through highly consistent workflow. Operation and maintenance features, including multi cluster distribution strategy, traffic provisioning and rolling update, are declared at the application level. Users do not need to care about any infrastructure details, but only need to define and deploy applications.
  • Programmable delivery workflow – kubevela’s model layer is implemented using cue. It allows you to easily declare the application delivery workflow as a DAG, and glue all steps and application deployment requirements together in a programmable way. There are no restrictions here, native extensibility.
  • Runtime independent – kubevela is a completely runtime independent application delivery and management control plane. It can deliver and manage any application component for the hybrid environment according to your defined workflow and policy: including container, cloud function, database and even AWS EC2 instance.

Now come with me and go into Kube Vela to find out!

You can familiarize yourself with the concept first

Docker: a common container.

Image: container mirroring. The core component of docker is simply understood as a copyable installation CD.

DockerHub: a container image public download center maintained by docker company.

Kubernetes: container scheduling standard, whose job is to uniformly manage and dispatch containers.

YAML: a configuration file format.

Don’t say much, come and knock the code happily to learn!

Try kubevela environment construction

This time, we will introduce the use of kind (kubernetes in docker) to build a local kubernetes environment. As the name implies, kubernetes in docker, so please make sure to follow the link to install it before continuing to look downDocker(\_https://docs.docker.com/desktop/\_)And kubernetes command line toolskubectl(\_https://kubernetes.io/zh/docs/tasks/tools/\_)。

Install kind. If it is a MacOS system, type:

curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-darwin-amd64chmod +x ./kindmv ./kind /some-dir-in-your-PATH/kind

For windows, use:

curl.exe -Lo kind-windows-amd64.exe https://kind.sigs.k8s.io/dl/v0.11.1/kind-windows-amd64Move-Item .\kind-windows-amd64.exe c:\some-dir-in-your-PATH\kind.exe

After installing kind, start kind and run the following command:


cat <<EOF | kind create cluster --image=kindest/node:v1.18.15 --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
EOF

At the same time, we need to install progress for kind. If kubernetes is regarded as the general manager of the “container Hotel”, ingress is similar to the receptionist of this hotel, who is responsible for guiding the “visiting guests” to the following specific steps, such as going to the restaurant, guest room or fitness:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml

When all the above are ready, it means that we have a complete kubernetes environment locally.

Next, let’s install Kube Vela. First, install helm chart, which is the package management tool of kubernetes ecology. Run:

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

Then add kubevela to helm chat:

helm repo add kubevela https://charts.kubevela.net/core

Then update helm chart:

helm repo update

Finally install kubevela:

helm install --create-namespace -n vela-system kubevela kubevela/vela-core

Let’s see if the installation was successful:

helm test kubevela -n vela-system

Prompt after success: welcome to use the kubevela! Enjoy your shipping application journey!

OK, let’s start writing the first kubevela demo!

KubeVela,Hello World!

In the environment configuration in the previous section, we started a kind cluster. You can view the relevant container information in the docker GUI:

We define a web service in the abstract way described by kubevela, which will pull the image named “crccheck / Hello world” on dockerhub.

apiVersion: core.oam.dev/v1beta1kind: Applicationmetadata:  name: first-vela-appspec:  components:    - name: express-server      type: webservice      properties:        image: crccheck/hello-world        port: 8000      traits:        - type: ingress          properties:            domain: testsvc.example.com            http:              "/": 8000

Then use kubectl apply command of kubernetes to deploy this ymal:

kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/vela-app.yaml

Since ingress for kind will bind the WebService declared in yaml to localhost by default, if you want to access the deployed application, you only need to type in the command line:

curl -H "Host:testsvc.example.com" localhost

Viola! The kindest word for us appeared: Hello world!

<xmp>Hello World

                                       ##         .                           
                                       ## ## ##        ==     
                                       ## ## ## ## ##    ===      
                                       /""""""""""""""""\___/ ===             
    ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~                           \______ o 
        _,/                            \      \       _,'                       
        
        `'--.._\..--''</xmp>
      
     

Summary and forecast

The above shows us a complete experience of the application delivery process brought by kubevela, which is as simple and direct as “it takes only three steps to put an elephant in the refrigerator”.

By writing an “application delivery plan” yaml file called application, we get a kubernetes component of web service type.

What is the mechanism behind the web service component? How does kubevela deliver helm components? How to deliver cloud service components? How do you orchestrate these components?

These will be left to the next issue. We will come back to explain in detail the core concepts of Kube Vela: application and components (component system).

If you want to better understand the kubevela project, you are welcome to search the nail group No. 23310022 or directly scan the code to join the community communication group:


Kubevela starts | making cloud application delivery more smooth

Copyright notice:The content of this article is spontaneously contributed by Alibaba cloud real name registered users, and the copyright belongs to the original author. Alibaba cloud developer community does not own its copyright or bear corresponding legal liabilities. Please refer to Alibaba cloud developer community user service agreement and Alibaba cloud developer community intellectual property protection guidelines for specific rules. If you find any content suspected of plagiarism in the community, fill in the infringement complaint form to report. Once verified, the community will immediately delete the content suspected of infringement.