Step-by-step instructions to install Knative with Istio 1.0.2 on IBM Cloud Kubernetes Service(IKS), build and push your image to IBM Cloud Container Registry and deploy the app.
For up-to-date instructions, refer to this article on Medium
- Install the cs (container-service) and cr (container-registry) plugins
ibmcloud plugin install container-service -r Bluemix
ibmcloud plugin install container-registry -r Bluemix
- Authorize ibmcloud:
ibmcloud login
-
Knative depends on Istio.
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/master/third_party/istio-1.0.2/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 STATUS of Running or Completed:
kubectl get pods --namespace istio-system
To Build a source into a container image from a Dockerfile inside a kubernetes cluster and push the image to IBM Cloud Container registry; all of this using Google's Kaniko tool, refer this link
OR
to build a container Image using Docker Daemon, follow the steps below
Rehash of helloworld-nodejs
- Clone the repo
git clone https://github.com/VidyasagarMSC/knative-deploy.git
cd knative-deploy
- Install dependencies
npm install
- Build and Push the Docker image to IBM Cloud Container Registry by replacing
<region>
and<namespace>
values
ibmcloud cr build -t registry.<region>.bluemix.net/<namespace>/knative-node-app .
- Open
service.yaml
, replaceimage
and run the below command
kubectl apply --filename service.yaml
- To find the IP address for your service, use
kubectl get svc knative-ingressgateway -n istio-system
to get the ingress IP for your cluster. If your cluster is new, it may take sometime for the service to get asssigned an external IP address.
export IP_ADDRESS=$(kubectl get svc knative-ingressgateway --namespace istio-system --output 'jsonpath={.status.loadBalancer.ingress[0].ip}')
- To find the URL for your service, use
kubectl get services.serving.knative.dev knative-node-app --output jsonpath='{.status.domain}'
export HOST_URL=$(kubectl get services.serving.knative.dev knative-node-app --output jsonpath='{.status.domain}')
- Now you can make a request to your app to see the result.
curl -H "Host: ${HOST_URL}" http://${IP_ADDRESS}
Node App running on IBM Cloud
- Run the below command to remove the sample app from your cluster
kubectl delete --filename service.yaml
- To delete the cluster, enter the following command:
ibmcloud cs cluster-rm $CLUSTER_NAME
- Build a container image inside a K8s cluster and push it to IBM Cloud Container Registry
- Knative Monitoring