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
Partner Zones AWS Cloud
by AWS Developer Relations
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
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Installing Knative on the IBM Cloud

Installing Knative on the IBM Cloud

Knative was announced as one of the solutions in the fight between serverless and containers. Take a look at these tips for easier installation.

Niklas Heidloff user avatar by
Niklas Heidloff
CORE ·
Oct. 19, 18 · Tutorial
Like (1)
Save
Tweet
Share
15.36K Views

Join the DZone community and get the full member experience.

Join For Free

I finally found some time to start playing with Knative. It took me a few hours to get a simple sample running. Below I describe some pitfalls when installing Knative and tips on how to avoid them. With the official instructions and these tips, it shouldn't take longer than half an hour to run your first container on Knative.

Knative is a very promising technology running on Kubernetes and Istio. Earlier this year I blogged and spoke about the topic When to use Serverless? When to use Kubernetes?. When Knative was announced in July, Jason McGee (IBM Fellow, IBM Cloud) wrote: "Today [...] we are one step closer to ending the serverless versus containers debate among developers." That's what immediately caught my attention.

I won't repeat Jason's blog here, but in summary, Knative allows running containers on Kubernetes only when they get requests. When they are not used anymore, they are terminated and make room for other workloads. So with Knative containers can scale from 0-N, rather than only 1-N.

I also think it's worth noting that similar to the Istio project, IBM is contributing to Knative and working closely together with Google.

This diagram shows how IBM Cloud Functions could potentially leverage Knative:

Now to the installation tips. There are two documents that describe how to set up Knative and how to run a first simple sample:

  • Knative Install on IBM Cloud Kubernetes Service
  • Getting Started with Knative App Deployment

Before following these steps, read through the following five points to save some time.

Tip 1) kubectl

Update the kubectl CLI! This cost me a lot of time since I had installed the latest version with brew but forgot to link it.

Tip 2) Kubernetes Version

When creating the Kubernetes cluster on the IBM Cloud, refer to the latest supported Kubernetes version 1.10.7, not 1.10.3 as the documentation says.

ibmcloud cs cluster-create --name=$CLUSTER_NAME \
  --zone=$CLUSTER_ZONE \
  --kube-version=1.10.7 \
  --machine-type=b2c.4x16 \
  --workers=3

Tip 3) istio-statsd-prom-bridge Pod

After installing Istio, the documentation says all pods need to have the status RUNNING. However the pod istio-statsd-prom-bridge has the status CrashLoopBackOff. While this doesn't seem to be critical to get Knative up and running, you can fix it as documented in this issue.

One line in the yaml file needs to be replaced:

Wrong: - -statsd.mapping-config=/etc/statsd/mapping.conf 

Right: - -statsd.mapping-config=/etc/statsd/mapping.conf  

Tip 4) Host URL

To find the host URL for your service, the documentation says the alias ksvc can be used. For me that didn't even work with Knative 0.1.1.

Wrong: kubectl get ksvc helloworld-go -output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain

Right:  kubectl get services.serving.knative.dev helloworld-go -output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain 

Tip 5) IP Address

For some reason sometimes when I create new Kubernetes clusters on the IBM Cloud I don't get public IP addresses immediately. You can check whether you have an IP address by invoking the following command. If EXTERNAL-IP is 'pending', you don't have one yet.

$kubectl get svc knative-ingressgateway --namespace istio-system

If you don't want to wait you can use the external IP of a worker node together with the NodePort of the knative-ingressgateway service. The documentation describes this, but reads the wrong IP from the worker node.

Wrong: kubectl get node -output 'jsonpath={.items[0].status.addresses[0].address} 
Right: kubectl get node -output 'jsonpath={.items[0].status.addresses[1].address} 

After this you can invoke your container via commands like this one. The header is needed to define the name of your service.

$ curl -H "Host: helloworld-go.default.example.com" 169.62.129.173:32380
IBM Cloud Kubernetes Cloud

Published at DZone with permission of Niklas Heidloff, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • What Are the Benefits of Java Module With Example
  • Stop Using Spring Profiles Per Environment
  • How To Build a Spring Boot GraalVM Image
  • Real-Time Analytics for IoT

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: