

Knative is a Kubernetes API extension which provides a set of API objects that Cloud providers can use to build serverless solutions. Since Knative runs on top of Kubernetes, it can be installed on any Kubernetes clusters. The current documentation does not explain how to do it on Amazon Web Services EKS service yet, so let’s do it in this post.
We will do two things:
> The initial version of this post is available on the AWS Open Source blog where we show how to combine our Knative Lambda Runtimes with AWS EKS.
The official EKS getting started guide is very complete. It guides you through configuring your CLI, and creating the Cloud Formation stacks necessary to provision your Kubernetes cluster. However there is a great CLI that can be used which simplifies some of the steps shown in the startup guide. That CLI is called eksctl, it was developed by folks at Weaveworks, the website has the entire documentation. Let’s use eksctl to create our EKS cluster.
You can install eksctl on your local machine. For instance, if you are using OSX and brew do:
Once the install is finished you can verify that eksctl is now in your $PATH:
You are now ready to use this CLI to create an EKS cluster quickly.
You can use the CLI and some of the optional arguments. However, a very declarative way to do it is to define your cluster options in a manifest and “apply” this manifest in a very Kubernetes like manner.
Let’s use this method and declare a cluster called knative, which will run in us-east-1 zone and contain 3 nodes of the instance type m5.large. The following command will create such manifest and save it in a file named cluster.yaml
To launch the provisioning do:
The above command will create a CloudFormation stack and take care of provisioning the security group, subnet and VPC that are described in the official getting started guide. The provisioning of the Kubernetes control plane and the nodes will take approximately 10 to 15 minutes.
Since we ran eksctl with the --kubeconfig option. The credentials used to access our Kubernetes cluster are stored in the file eksknative.yaml in the directory where we ran the command from. This has the advantage of keeping our main kubeconfig file clean, but it has the disadvantage that we now need to specify this file on every kubectl command.
For convenience, let’s just set up an alias that will specify our configuration file when we use kubectl:
To verify that access to your cluster is working properly issue the following commands which should list the three nodes in your cluster:
With a working EKS cluster on hand, we are now ready to install Knative in it.
Installing Knative can be done in a few kubectl apply commands. A default Knative installation will use the Istio service mesh.
To install Istio use the following two commands, note the use of our alias to kubectl --kubeconfig=eksknative.yaml which uses the proper cluster configuration file
Once this completes you can move on to installing the Knative components: Build and Serving. In this post, we will skip the installation of the Eventing component since we are not making use of it here.
> If the installation above fails, apply the manifest again. The declarative aspect of Kubernetes will make sure that all the objects get created.
After a few minutes you should be able to list the Pods in the several namespaces that the previous commands have created, namely:
Once all the Pods are in running state, congratulations you have installed Knative on your EKS cluster.
You can now start studying the Knative examples, like the basic Hello World example.