DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Install Knative With Istio on an IKS Cluster and Deploy on IBM Cloud

Install Knative With Istio on an IKS Cluster and Deploy on IBM Cloud

Learn how Knative extends Kubernetes and how to set up an app with Knative and Istio, then deploy on IBM Cloud.

Vidyasagar Machupalli user avatar by
Vidyasagar Machupalli
CORE ·
Oct. 09, 18 · Tutorial
Like (4)
Save
Tweet
Share
6.41K Views

Join the DZone community and get the full member experience.

Join For Free

This post provides you step-by-step instructions to install Knative with Istio on IBM Cloud Kubernetes Service (IKS), build and push your image to IBM Cloud Container Registry and deploy the app. 

Before jumping into the instructions, let’s quickly understand what Knative is and what are its key components.

Knative extends Kubernetes to provide the missing building blocks that developers need to create modern, source-centric, container-based, cloud-native applications.

Image title


Each of the components under the Knative project attempt to identify common patterns and codify the best practices shared by successful real-world Kubernetes-based frameworks and applications, such as

  • Orchestrating source-to-container workflows
  • Routing and managing traffic during deployment
  • Scaling and sizing resources based on demand
  • Binding running services to eventing ecosystems

Knative focuses on the “boring but difficult” parts that everyone needs, but no one benefits from doing over again on their own. This in-turn frees developers to spend more time writing application code, not worrying about how they are going to build, deploy, monitor, and debug it.

Knative Components

Currently, Knative consists of the following top-level repositories:

  • Build and build-templates — automatic, repeatable server-side container builds
  • Serving — scale to zero, request-driven compute
  • Eventing — management and delivery of events

We expect this list to grow as more areas are identified.

Prerequisites

  • Node and npm
  • Download and install the ibmcloud command line tool

Setup CLI

  • 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

Create a Kubernetes Cluster and Set Up Istio

In this section, you will provision a Kubernetes cluster on IBM Cloud Kubernetes service(IKS) and install Istio + Knative components.

  • Setup environment variables

  • Follow the steps to Create a Kubernetes Cluster

kubectl apply --filename kubectl apply --filename https://raw.githubusercontent.com/knative/serving/master/third_party/istio-1.0.2/istio.yaml
Install Istio
  • 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
  • Install Knative components
  • To check Knative installation:
To verify Knative installation

Build and Deploy the App

This section uses a rehash of helloworld-nodejs app. For code samples in other programming languages(Go, Python, C#, Java etc.,), refer Knative serving sample applications 

  • Clone the repo and cdinto the cloned folder
git clone https://github.com/VidyasagarMSC/knative-deploy
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 .
  • Inservice.yaml replace imagevalue and run the below command
apiVersion: serving.knative.dev/v1alpha1 # Current version of Knative
kind: Service
metadata:
  name: knative-node-app # The name of the app
  namespace: default # The namespace the app will use
spec:
  runLatest:
    configuration:
      revisionTemplate:
        spec:
          container:
            image: registry.{REGION}.bluemix.net/{NAMESPACE}/knative-node-app # The URL to the image of the app on IBMCLOUD Registry
            env:
            - name: TARGET # The environment variable printed out by the sample app
              value: "Knative Node App running on IBM Cloud"


kubectl apply --filename service.yaml
  • To find the IP address for your service, use kubectl get svc knative-ingressgateway -n istio-systemto get the ingress IP for your cluster. If your cluster is new, it may take sometime for the service to get assigned 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}
Response: Node App running on IBM Cloud

Cleanup

  • Run the below command to remove the sample app from your cluster
kubectl delete --filename service.yaml
  • To delete the cluster (removes everything), enter the following command:
ibmcloud cs cluster-rm $CLUSTER_NAME

Further Reading

  • IBM, Google Give Birth to Knative Serverless Cloud Project 
  • Knative Docs
Docker (software) IBM Cloud Cloud Kubernetes

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Bye-Bye, Regular Dev [Comic]
  • An Introduction to Data Mesh
  • Stream Processing vs. Batch Processing: What to Know
  • Quick Pattern-Matching Queries in PostgreSQL and YugabyteDB

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: