This demo will setup an env on Eclipse Che to code, build and run a Function on your Kubernetes and OpenShift cluster using Knative and Serverless.com components. Components give the possiblity of delegating the build phase to the cluster, so that can be done for you by Kaniko or Source-to-Image when using Knative Component.
Serverless.com components require a login at Serverless.com.
From Dashboard, Create an Access Key, we will use it for Deploying the function: https://app.serverless.com/<YOUR_ORG>/settings/accessKeys
Install Knative or OpenShift Serverless in your cluster. Get them from OperatorHub or from OperatorHub embedded marketplace inside OpenShift.
Populate the .env
file with your cluster info:
- KUBERNETES_ENDPOINT: Cluster API URL (e.g. https://api.my-cluster.tld)
- KUBERNETES_PORT: Cluster API port (e.g. 6443)
- KUBERNETES_SERVICE_ACCOUNT_TOKEN: get your k8s user serviceaccount token (e.g. in OpenShift
oc whoami -t
) - KUBERNETES_SKIP_TLS_VERIFY: skip TLS verification if you are not using trusted certificates for API (e.g. true)
if you are using it on Kubernetes, a Docker Hub account is required. Add these credentials to the .env
file then:
- DOCKER_USERNAME: Docker Hub username
- DOCKER_PASSWORD: Docker Hub password
Update the org property in the serverless.yml file with the name of your serverless.com account.
- org: Your Organization/User at https://app.serverless.com/
Code, build, test and deploy your Function as scale-to-zero app directly from Eclipse Che in-browser IDE: