7.0 KiB
Knative Install on IBM Cloud Kubernetes Service (IKS)
This guide walks you through the installation of the latest version of Knative using pre-built images.
You can find guides for other platforms here.
Before you begin
Knative requires a Kubernetes cluster v1.10 or newer. This guide walks you through creating a cluster with the correct specifications for Knative on IBM Cloud Kubernetes Service.
This guide assumes you are using bash in a Mac or Linux environment; some commands need to be adjusted for use in a Windows environment.
Installing the IBM Cloud developer tools
If you already have
ibmcloudinstalled with theibmcloud csplugin, you can skip these steps.
-
Download and install the
ibmcloudcommand line tool: https://console.bluemix.net/docs/cli/index.html#overview -
Install the
cs(container-service) plugin:ibmcloud plugin install container-service -r Bluemix -
Authorize
ibmcloud:ibmcloud login
Setting environment variables
To simplify the command lines for this walkthrough, you need to define a few environment variables.
-
Set
CLUSTER_NAME,CLUSTER_REGION, andCLUSTER_ZONEvariables:export CLUSTER_NAME=knative export CLUSTER_REGION=us-south export CLUSTER_ZONE=dal13CLUSTER_NAMEmust be lowercase and unique among any other Kubernetes clusters in this IBM Cloud region.CLUSTER_REGIONcan be any region where IKS is available. You can get a list of all available regions via the IBM Cloud documentation or viaibmcloud cs regions.CLUSTER_ZONEcan be any zone that is available in the specified region above. You can get a list of all avaible locations from the IBM Cloud documentation or by usingibmcloud cs zonesafter you set the region by usingibmcloud cs region-set $CLUSTER_REGION.
Creating a Kubernetes cluster
To make sure the cluster is large enough to host all the Knative and Istio components, the recommended configuration for a cluster is:
- Kubernetes version 1.10 or later
- 4 vCPU nodes with 16GB memory (
b2c.4x16)
-
Set
ibmcloudto the appropriate region:ibmcloud cs region-set $CLUSTER_REGION -
Create a Kubernetes cluster on IKS with the required specifications:
ibmcloud cs cluster-create --name=$CLUSTER_NAME \ --zone=$CLUSTER_ZONE \ --kube-version=1.10.3 \ --machine-type=b2c.4x16 \ --workers=3If you're starting in a fresh account with no public and private VLANs, they are created automatically for you. If you already have VLANs configured in your account, get them via
ibmcloud cs vlans --zone $CLUSTER_ZONEand include the public/private VLAN in thecluster-createcommand:ibmcloud cs cluster-create --name=$CLUSTER_NAME \ --zone=$CLUSTER_ZONE \ --kube-version=1.10.3 \ --machine-type=b2c.4x16 \ --workers=3 \ --private-vlan $PRIVATE_VLAN_ID \ --public-vlan $PUBLIC_VLAN_ID -
Wait until your Kubernetes cluster is deployed:
ibmcloud cs clusters | grep $CLUSTER_NAMEIt can take a while for your cluster to be deployed. Repeat the above command until the state of your cluster is "normal".
-
Point
kubectlto the cluster:ibmcloud cs cluster-config $CLUSTER_NAMEFollow the instructions on the screen to
EXPORTthe correctKUBECONFIGvalue to point to the created cluster. -
Make sure all nodes are up:
kubectl get nodesMake sure all the nodes are in
Readystate. You are now ready to install Istio into your cluster.
Installing Istio
Knative depends on Istio.
- Install Istio:
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.1.1/third_party/istio-0.8.0/istio.yaml - Label the default namespace with
istio-injection=enabled:kubectl label namespace default istio-injection=enabled - Monitor the Istio components until all of the components show a
STATUSofRunningorCompleted:kubectl get pods --namespace istio-system
It will take a few minutes for all the components to be up and running; you can rerun the command to see the current status.
Note: Instead of rerunning the command, you can add
--watchto the above command to view the component's status updates in real time. Use CTRL+C to exit watch mode.
Installing Knative components
You can install the Knative Serving and Build components together, or Build on its own.
Installing Knative Serving and Build components
- Run the
kubectl applycommand to install Knative and its dependencies:kubectl apply --filename https://github.com/knative/serving/releases/download/v0.1.1/release.yaml - Monitor the Knative components until all of the components show a
STATUSofRunning:kubectl get pods --namespace knative-serving kubectl get pods --namespace knative-build
Installing Knative Build only
- Run the
kubectl applycommand to install Knative Build and its dependencies:kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.1.1/third_party/config/build/release.yaml - Monitor the Knative Build components until all of the components show a
STATUSofRunning:kubectl get pods --namespace knative-build
Just as with the Istio components, it will take a few seconds for the Knative
components to be up and running; you can rerun the kubectl get command to see
the current status.
Note: Instead of rerunning the command, you can add
--watchto the above command to view the component's status updates in real time. Use CTRL + C to exit watch mode.
You are now ready to deploy an app or create a build in your new Knative cluster.
Deploying an app
Now that your cluster has Knative installed, you're ready to deploy an app.
You have two options for deploying your first app:
-
Follow the step-by-step Getting Started with Knative App Deployment guide.
-
View the available sample apps and deploy one of your choosing.
Cleaning up
Running a cluster in IKS costs money, so if you're not using it, you might want to delete the cluster when you're done. Deleting the cluster also removes Knative, Istio, and any apps you've deployed.
To delete the cluster, enter the following command:
ibmcloud cs cluster-rm $CLUSTER_NAME
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License.