There are times when something new gets added to an offering and on the surface, it seems pretty small, even though it actually has quite a big impact on the people who are using it.
Today, in this relatively short blog post, I get to talk about one that I'm pretty excited about. Without calling it out by name, let's just see it in action with a very simple example.
First, the really easy way
$ kn service create hello --image duglin/hello $ curl -s hello-default.demo.us-south.containers.appdomain.cloud Hello World! $ curl -s https://hello-default.demo.us-south.containers.appdomain.cloud Hello World!
Not that I think it really requires a lot of explaining, but for those who are a bit new to containers, here's what just happened:
- I created a Knative "service" called "hello" by using a pre-built image in DockerHub called "duglin/hello."
- I sent an HTTP GET to the service and got a response.
- I sent an HTTPS GET to the service and got a response.
Under the covers, between Knative and IBM Cloud Kubernetes Service, an application was deployed, a URL was assigned to it, and an SSL cert was associated with it so I can reach it via HTTPS—all automatically!
Knative did most of the work related to deploying the Kubernetes pods running behind the scenes, but IBM Cloud Kubernetes Service automatically set up the "real" hostname and the SSL cert for me. This auto-setup of the networking (both the URL/hostname and SSL cert) is new and saves the user the hassle of having to do it themselves.
Normally, a user would have to register a domain name (or use an existing one they already had), get an SSL certificate for that domain name, and then set up the DNS records to point to their Kubernetes cluster. Not necessarily rocket science, but it's non-trivial and not something most people want to do if they can avoid it. As of today, IBM Cloud Kubernetes Service does it all for you. As I said, I'm not sure deploying an image can get much easier than that.
Now, the other easy way
Now, some people might be wondering if the kn command line tool is doing some magic for us—it's not, it's just Knative's CLI which generates some Kubernetes yaml for us and sends it along to Kubernetes. But for those who prefer to go Kubernetes-old-school, we could have done this:
$ cat service.yaml apiVersion: serving.knative.dev/v1alpha1 kind: Service metadata: name: hello spec: runLatest: configuration: revisionTemplate: spec: container: image: duglin/hello $ kubectl apply -f service.yaml $ curl https://hello-default.demo.us-south.containers.appdomain.cloud Hello World!
I was able to reproduce the exact same results of deploying an application via a single command line. While the yaml file is bit more verbose than we'd like (and that'll change soon in v0.6 of Knative), it really only has the same two pieces of information we saw on the kn command: the service name and the container image name.
One final thing—keeping in-tune with the idea of simplicity, how about the process to install Knative? Well, what about this:
$ ibmcloud ks cluster-addon-enable knative -y --cluster demo
Yes, with IBM Cloud Kubernetes Service, you can do the following:
- Install Knative with a single command (or button click in the UI).
- Deploy a new application with a single command.
You'll be left with an application that will scale up as the load increases, scale down to zero when it's idle, and be automatically secured with SSL.
I think that's a pretty sweet developer experience!
Give it a try and let me know what you think.