Before deploying the app, let's create a new environment/namespace called kubecon
for the tests.
vela env init kubecon --namespace kubecon
environment kubecon with namespace kubecon created
Next, deploy a basic nginx application with:
vela up -f scenarios/basic_app/nginx-app.yml
Applying an application in vela K8s object format...
I0410 18:35:46.570023 2935 apply.go:121] "creating object" name="nginx-app" resource="core.oam.dev/v1beta1, Kind=Application"
✅ App has been deployed 🚀🚀🚀
Port forward: vela port-forward nginx-app -n kubecon
SSH: vela exec nginx-app -n kubecon
Logging: vela logs nginx-app -n kubecon
App status: vela status nginx-app -n kubecon
Endpoint: vela status nginx-app -n kubecon --endpoint
To access the application use:
curl http://127.0.0.1:80
If the cluster has been installed with velad
instead of kind
you can access the app with:
curl http://127.0.0.1:8090/
If that port is not accessible, check the port redirections as they may change depending on the elements deployed on your local machine.
$ docker ps | grep proxy
20f47c1c7297 ghcr.io/k3d-io/k3d-proxy:5.4.6 "/bin/sh -c nginx-pr…" 2 hours ago Up 2 hours 0.0.0.0:6443->6443/tcp, 0.0.0.0:8090->80/tcp k3d-velad-cluster-default-serverlb
OAM applications can be deployed using the standard Kubernetes API as any other CRD. To do that, use:
kubectl --context kind-kubevela -n kubecon create -f scenarios/01.basic_app/nginx-app.yml
application.core.oam.dev/nginx-app created
For installations with velad
, make sure you have exported the kubeconfig file as defined in the previous step if you are not able to connect to Kubernetes.
Next, check the status of the application with:
kubectl --context kind-kubevela -n kubecon get app
NAME COMPONENT TYPE PHASE HEALTHY STATUS AGE
nginx-app nginx webservice running true Ready:1/1 8s
To delete an application with the vela cli use:
vela delete nginx-app
Are you sure to delete the application kubecon/nginx-app (y/n)y
Start deleting appplication kubecon/nginx-app
Delete appplication kubecon/nginx-app succeeded
As an alternative, you may use kubectl directly with:
$ kubectl --context kind-kubevela -n kubecon delete app nginx-app
application.core.oam.dev "nginx-app" deleted