kubevela

module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2020 License: Apache-2.0

README

KubeVela

The Open Application Platform based on Kubernetes and OAM.

🚨 Warning: The project is still under heavy development, its UI/UX is also for demo purpose, please don't look inside unless you know what you are doing Please contact @wonderflow if you are interested in its full story or becoming one of the boostrap contributors/maintainers. 🚨

Install

Prerequisites
  • Kubernetes cluster running Kubernetes v1.15.0 or greater
  • kubectl current context is configured for the target cluster install
    • kubectl config current-context
Get the Vela CLI

Download the vela binary from the Releases page. Unpack the vela binary and add it to $PATH to get started.

sudo mv ./vela /usr/local/bin/vela
Install Vela Core
$ vela install

This command will install vela core controller into your K8s cluster, along with built-in workloads and traits.

Demos

After vela install you will have workloads and traits locally, and available to use by vela cli.

$ vela workloads
NAME         	DEFINITION
backend      	containerizeds.standard.oam.dev
containerized	containerizedworkloads.core.oam.dev
task         	jobs
webservice   	containerizeds.standard.oam.dev
$ vela traits
NAME        	DEFINITION                        	APPLIES TO
route       	routes.standard.oam.dev           	webservice
            	                                  	backend            	                                  
scale       	manualscalertraits.core.oam.dev   	webservice
            	                                  	backend
Create ENV

Before working with your application, you should create an env for it.

$ vela env init myenv --namespace myenv --email my@email.com --domain kubevela.io
ENV myenv CREATED, Namespace: myenv, Email: my@email.com.

It will create a namespace called myenv

$ kubectl get ns
NAME        STATUS   AGE
myenv       Active   40s

A namespace level issuer for certificate generation with email.

$ kubectl get issuers.cert-manager.io -n myenv
  NAME            READY   AGE
  oam-env-myenv   True    40s

A env metadata in your local:

$ cat ~/.vela/envs/myenv/config.json
  {"name":"myenv","namespace":"myenv","email":"my@email.com","domain":"kubevela.io","issuer":"oam-env-myenv"}
Create Component

Then let's create application, we will use our env created by default.

$ vela comp run mycomp -t webservice --image crccheck/hello-world --port 8000 --app myapp
Creating AppConfig appcomp
SUCCEED

It will create component named mycomp.

$ kubectl get components -n myenv
  NAME     WORKLOAD-KIND   AGE
  mycomp   Containerized   10s

And an AppConfig named myapp.

$ kubectl get appconfig -n myenv
  NAME    AGE
  myapp   24s

Vela Core will work for AppConfig and create K8s deployment and service.

$ kubectl get deployment -n myenv
  NAME     READY   UP-TO-DATE   AVAILABLE   AGE
  mycomp   1/1     1            1           38s
$ kubectl get svc -n myenv
 NAME     TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
 mycomp   ClusterIP   172.21.4.228   <none>        8080/TCP   49s
Multiple Component

Creating a new component in the same application is easy, just use the --app flag.

$ vela comp run db -t backend --image crccheck/hello-world --app myapp
Creating App myapp
SUCCEED
$ vela comp ls
NAME  	APP  	WORKLOAD  	TRAITS	STATUS 	  CREATED-TIME
db    	myapp	backend   	      	Deployed	2020-09-18 22:42:04 +0800 CST
mycomp	myapp	webservice	      	Deployed	2020-09-18 22:42:04 +0800 CST

Now we can see the application deployed, let's add route trait for visiting.

Add Trait
$ vela route mycomp --app myapp
 Adding route for app mycomp
 Succeeded!

It will create route trait for this component.

$ kubeclt get routes.standard.oam.dev -n myenv
NAME                     AGE
mycomp-trait-5b576c4fc   18s

Controller of route trait which is part of vela core will create an ingress for it.

$ kubectl get ingress -n myenv
NAME                        HOSTS                ADDRESS         PORTS     AGE
mycomp-trait-5b576c4fc      mycomp.kubevela.io   123.57.10.233   80, 443   73s

Please configure your domain pointing to the public address.

Then you will be able to visit it by https://mycomp.kubevela.io, mTLS is automatically enabled.

Check Status

App level:

$ vela app show myapp
  About:
  
    Name:      	myapp
    Created at:	2020-09-18 22:42:04.191171 +0800 CST
    Updated at:	2020-09-18 22:51:11.128997 +0800 CST
  
  
  Environment:
  
    Namespace:	myenv
  
  Components:
  
    Name  	Type      	Traits
    db    	backend
    mycomp	webservice	route

Component Level:

$ vela comp show mycomp
 About:
 
   Name:        	mycomp
   WorkloadType:	webservice
   Application: 	myapp
 
 Environment:
 
   Namespace:	myenv
 
 Arguments:
 
   image:	crccheck/hello-world
   name: 	mycomp
   port: 	8000
 
 
 Traits:
 
   route:
     domain:	mycomp.kubevela.io
     issuer:	oam-env-myenv
     name:  	route
$ vela comp status mycomp
  Showing status of Component mycomp deployed in Environment myenv
  Component Status:
  	Name: mycomp  Containerized(type) UNKNOWN APIVersion standard.oam.dev/v1alpha1 Kind Containerized workload is unknown for HealthScope
  	Traits
  	    └─Trait/route
  
  Last Deployment:
  	Created at: 2020-09-18 22:42:04 +0800 CST
  	Updated at: 2020-09-18T22:51:11+08:00
Delete App or Component
$ vela app ls
myapp
$ vela comp ls
NAME  	APP  	WORKLOAD  	TRAITS	STATUS 	CREATED-TIME
db    	myapp	backend   	      	Deployed	2020-09-18 22:42:04 +0800 CST
mycomp	myapp	webservice	route 	Deployed	2020-09-18 22:42:04 +0800 CST
$ vela comp delete db
Deleting Component 'db' from Application 'db'
$ vela comp ls
NAME  	APP  	WORKLOAD  	TRAITS	STATUS 	CREATED-TIME
mycomp	myapp	webservice	route 	Deployed	2020-09-18 22:42:04 +0800 CST
$ vela app delete myapp
Deleting Application "myapp"
delete apps succeed myapp from myenv

Dashboard

We also prepared a dashboard for you, but it's still in heavily development.

$ vela dashboard
Auto-Completion
bash
To load completions in your current shell session:
$ source <(vela completion bash)

To load completions for every new session, execute once:
Linux:
  $ vela completion bash > /etc/bash_completion.d/vela
MacOS:
  $ vela completion bash > /usr/local/etc/bash_completion.d/vela
zsh
To load completions in your current shell session:
$ source <(vela completion zsh)

To load completions for every new session, execute once:
$ vela completion zsh > "${fpath[1]}/_vela"
Clean your environment
$ helm uninstall vela-core -n oam-system
release "vela-core" uninstalled
$ kubectl delete crd workloaddefinitions.core.oam.dev traitdefinitions.core.oam.dev
customresourcedefinition.apiextensions.k8s.io "workloaddefinitions.core.oam.dev" deleted
customresourcedefinition.apiextensions.k8s.io "traitdefinitions.core.oam.dev" deleted
$ rm -r ~/.vela

CONTRIBUTING

Check out CONTRIBUTING.md to see how to develop with KubeVela.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the standard v1alpha1 API group +kubebuilder:object:generate=true +groupName=standard.oam.dev
Package v1alpha1 contains API Schema definitions for the standard v1alpha1 API group +kubebuilder:object:generate=true +groupName=standard.oam.dev
cmd
hack
pkg
cue
oam

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL