README.md 6.81 KB
Newer Older
GUY SHARON's avatar
GUY SHARON committed
1
2
~known-issues

GUY SHARON's avatar
GUY SHARON committed
3
[IBM and Knative Blog by Jason McGee, VP and IBM Fellow, IBM Cloud](https://www.ibm.com/blogs/cloud-computing/2018/07/24/ibm-cloud-google-knative-serverless/)
4

GUY SHARON's avatar
GUY SHARON committed
5
6
# The start-with-knative Toolchain

7
This toolchain provides automation to stand up a [Knative](https://github.com/knative/) environment in [IBM Cloud Kubernetes Service](https://www.ibm.com/cloud/container-service) (IKS) as an add-on based on the instructions provided [here](https://cloud.ibm.com/docs/containers/cs_tutorials_knative.html#knative_tutorial). It includes the creation of a cluster and the installation of Knative add-on to IKS which includes Istio and all Knative components. The toolchain also includes a step to install a Helm chart which will deploy a Hello World Knative application and will interact with it as a sanity check. LogDNA and Sysdig services can also be setup to log and monitor the cluser. Finally, the toolchain includes steps to clean and destroy all the setup.
GUY SHARON's avatar
GUY SHARON committed
8
9
10
11
12
13
14

The creation of this toolchain using the button below requires the setting of only three parameters:

1. A Platform API Key which can be created [here](https://console.bluemix.net/iam/#/apikeys) if you have never set one before.
2. The region to deploy the cluster in.
3. The zone within region to deploy the cluster in.  

GUY SHARON's avatar
GUY SHARON committed
15
> By specifying details of an existing cluster, this toolchain can also be used to setup Knative on an existing cluster as long as the Kubernetes version of that cluster is 1.11.7.  
GUY SHARON's avatar
GUY SHARON committed
16
Just delete the CREATE CLUSTER stage in the pipeline after deployment.
GUY SHARON's avatar
GUY SHARON committed
17
18
19
20
21
22
23
24
25
26
27
28

[![Deploy to IBM Cloud](https://bluemix.net/deploy/button_x2.png)](https://console.bluemix.net/devops/setup/deploy?repository=https://git.ng.bluemix.net/start-with-knative/toolchain.git)  

The toolchain created has a link to this repository and a Delivery Pipeline set with a [pipeline](#pipeline) that builds a helm chart, creates a Kubernetes cluster, installs Istio and Knative, installs the helm chart of a Knative application to the cluster, removes the release from the cluster and deletes the cluster.

> **Note** - the pipeline stages are set to be executed manually so that you can pick the appropriate time and stage to execute.

Upon successful completion of installing the Helm chart, you will be able to interact with the application with the following details:

1. Retrieve the external IP address of Knative

    ```bash
GUY SHARON's avatar
GUY SHARON committed
29
    export IP_ADDRESS=$(kubectl get svc istio-ingressgateway -n istio-system -o 'jsonpath={.status.loadBalancer.ingress[0].ip}')
GUY SHARON's avatar
GUY SHARON committed
30
31
32
33
34
    ```

2. Retrieve the host URL - domain that identifies the Knative application

    ```bash
GUY SHARON's avatar
GUY SHARON committed
35
    export HOST_URL=$(kubectl get services.serving.knative.dev start-with-knative -o jsonpath='{.status.domain}')
GUY SHARON's avatar
GUY SHARON committed
36
37
38
39
40
41
42
43
44
45
    ```

3. Interact with the application as such

    ```bash
    curl -H "Host: ${HOST_URL}" http://${IP_ADDRESS}
    ```

## Preconfigured and immutable parameters

GUY SHARON's avatar
GUY SHARON committed
46
The pipeline is preconfigured with the following parameters that can not be changed.  
GUY SHARON's avatar
GUY SHARON committed
47
48
49
50

1. The number of worker nodes `3` when creating the Kubernetes cluster
2. The worker nodes machine type `b2c.4x16`
3. The Helm release name `start-with-knative`
GUY SHARON's avatar
GUY SHARON committed
51
4. Kubernetes version 1.11.7 is used supporting Knative add-on to IKS
GUY SHARON's avatar
GUY SHARON committed
52
53
54
55
56
57
58
59
60

## Parameters for Toolchain Creation

Beyond the required parameters mentioned above, there are optional parameters to be set.

1. The cluster name, **required**, can be changed from the default `cluster-start-with-knative` though there are length `32` and character `alphanumeric and dash` restrictions.
2. Set Public VLAN ID, **optional**, if you have a public VLAN in the zone you are creating the cluster in. If left empty, the script will look for an existing public VLAN and if it can not find one, the creation of the cluster will resource a new one.
3. Set Private VLAN ID, **optional**, if you have a private VLAN in the zone you are creating the cluster in. If left empty, the script will look for an existing private VLAN and if it can not find one, the creation of the cluster will resource a new one.
4. Set Kubernetes namespace, **optional**, to install the helm chart in. `default` is used unless a different namespace is specified.
61
62
63

    > **Note:** Installing using a different namespace has not been tested.

GUY SHARON's avatar
GUY SHARON committed
64
65
66
67
68
69
70
71
72
73
74
75
76
5. Set Output text, **optional**, for the Knative application to return when called. Application will return `Hello World:` and the Output specified.

## Pipeline

The delivery pipeline set by the toolchain is depicted below

![Stages of the Delivery Pipeline](./images/start-with-knative-pipeline.png)

- **BUILD** stage packages the Helm chart for installation. It will run immediately upon the toolchain creation, but is set not to trigger on any commit.
- **CREATE CLUSTER** stage checks if there is a cluster in the given region and zone with the given name. If the cluster doesn't exist, a new cluster is created.  
  The stage then completes by setting up Helm on the cluster.  
  This and all following stages are set to be triggered manually.

77
  > **Note:** this stage may take several minutes to complete if a cluster is being created - *30 minutes observed*  
GUY SHARON's avatar
GUY SHARON committed
78
79
  > Delete this stage if an existing cluster is being set up with Knative.

GUY SHARON's avatar
GUY SHARON committed
80
- **INSTALL KNATIVE** stage installs the Knative add-on to the cluster.
81
- **SETUP LOG AND MONITOR** stage creates LogDNA and Sysdig services and sets up agents on the cluster.
GUY SHARON's avatar
GUY SHARON committed
82
- **DEPLOY HELLO APP** stage installs the packaged chart - a Knative Hello World application.
GUY SHARON's avatar
GUY SHARON committed
83
- **DELETE HELLO APP** stage deletes the release installed in the previous stage.
GUY SHARON's avatar
GUY SHARON committed
84
85
- **DELETE CLUSTER** stage deletes the cluster including the virtual servers. VLANs and subnets will remain and will eventually be removed automatically as long as they are 'empty'.

86
<img src="./images/ibmcloud.png" title="IBM Cloud" alt="IBM Cloud" width="80" height="80"> <img src="./images/iks.png" title="IBM Cloud Kubernetes Service" alt="IBM Cloud Kubernetes Service" width="80" height="80"> <img src="./images/kubernetes.png" title="Kubernetes" alt="Kubernetes" width="80" height="80"> <img src="./images/istio.png" title="Istio" alt="Istio" width="80" height="80"> <img src="./images/knative.png" title="Knative" alt="Knative" width="80" height="80"> <img src="./images/helm.png" title="Helm" alt="Helm" width="80" height="80"> <img src="./images/toolchain.png" title="Toolchain" alt="Toolchain" width="80" height="80"> <img src="./images/git.png" title="IBM hosted GitLab" alt="IBM hosted GitLab" width="80" height="80"> <img src="./images/pipeline.png" title="Continuous Delivery" alt="Continuous Delivery" width="80" height="80"> <img src="./images/logdna.png" title="LogDNA" alt="LogDNA" width="80" height="80"> <img src="./images/sysdig.png" title="Sysdig" alt="Sysdig" width="80" height="80">
GUY SHARON's avatar
GUY SHARON committed
87
88

<!--![IBM Cloud](./images/ibmcloud.png) ![IBM Cloud Kubernetes Service](./images/iks.png) ![Kubernetes](./images/kubernetes.png) ![Helm](./images/helm.png) ![Istio](./images/istio.png) ![Knative](./images/knative.png)-->