Giter Club home page Giter Club logo

minikube-kamel's Introduction

Minikube Kamel

Minor POC with Kamel integrations running on Minikube

Camel-K is the new way to use the power of serverless and Camel.

With Camel-K now is possible to upload to Kubernetes (or Openshift) a route (called in this context "integration") and use it as a lambda function.

How

First of all, install Minikube (and kubectl).

Start minikube (in my case, using virtualbox as driver):

~$ minikube start --vm-driver=virtualbox

at some point I had problems because I was starting minikube as root user

Once minikube is running start the kubernetes dashboard:

~$ kubectl proxy
Starting to serve on 127.0.0.1:8001

Now what we should do to use Camel-K.

Enable minikube registry:

~$ minikube addons enable registry
registry was successfully enabled

Download Kamel release.

Install it:

~/path/to/kamel/$ ./kamel install --cluster-setup

In the Kubernetes dashboard now we will have new pods and deployments.

Running

In this repo we have the routes-rest.js example that expose a rest-api.

To deploy and attach to the log output:

~/path/to/project/$ ~/path/to/kamel/kamel run --name=withrest --dependency=camel-undertow routes-rest.js --dev
  • --dev, attach to logs output and enable hotdeploy
  • --name, add a custom name to the integration (filename by default)
  • --dependency, explicity an package dependency

in Java, --dependency is "almost" desnecessary to use this because Kamel recognize and download by it self

The output will be something similar to:

[1] 2018-11-10 18:21:04.861 INFO  [main] Runtime - Routes: file:/etc/camel/conf/routes-rest.js
[1] 2018-11-10 18:21:04.865 INFO  [main] Runtime - Language: js
[1] 2018-11-10 18:21:05.813 INFO  [main] DefaultTypeConverter - Type converters loaded (core: 195, classpath: 6)
[1] 2018-11-10 18:21:05.832 INFO  [main] DefaultCamelContext - Apache Camel 2.22.1 (CamelContext: camel-1) is starting
[1] 2018-11-10 18:21:05.834 INFO  [main] ManagedManagementStrategy - JMX is enabled
[1] 2018-11-10 18:21:06.041 INFO  [main] DefaultCamelContext - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
[1] 2018-11-10 18:21:06.153 INFO  [main] DefaultCamelContext - Route: js started and consuming from: timer://js?period=1s
[1] 2018-11-10 18:21:06.168 INFO  [main] DefaultUndertowHost - Starting Undertow server on http://0.0.0.0:8080
[1] 2018-11-10 18:21:06.183 INFO  [main] xnio - XNIO version 3.3.8.Final
[1] 2018-11-10 18:21:06.189 INFO  [main] nio - XNIO NIO Implementation Version 3.3.8.Final
[1] 2018-11-10 18:21:06.264 INFO  [main] DefaultCamelContext - Route: route1 started and consuming from: http://0.0.0.0:8080/say/hello?httpMethodRestrict=GET%2COPTIONS&matchOnUriPrefix=false
[1] 2018-11-10 18:21:06.265 INFO  [main] DefaultCamelContext - Total 2 routes, of which 2 are started
[1] 2018-11-10 18:21:06.266 INFO  [main] DefaultCamelContext - Apache Camel 2.22.1 (CamelContext: camel-1) started in 0.433 seconds

Once started with the success we still not able to hit it because we don't have access to the pod where our integration is running.

Exposing port:

~$ kubectl expose deployment withrest --name withrest-lb --type=LoadBalancer --port 8080
service/withrest-lb exposed

Fetch the url for our integration:

~$ minikube service withrest-lb --url
minikube service withrest-lb --url

Or taking a shortcut:

~$ curl $(minikube service withrest-lb --url)/say/hello
Hello World

Why?

Be able to use the Camel DSL and all the components by itself already look like a really good reason to use it. Not even talking about the EIP but all the uses this could have like an alternative to ETL tools like Kettle or with something like Kafka Streams could lead to a very fast design with high decoupled systems.

Truth is, the project is in a very early stage, now is the time to contribute.

Roadmap

  • write integrations using more components and languages

Meta

Alex Rocha - about.me

minikube-kamel's People

Contributors

alexrochas avatar

Stargazers

Ricardo Conceição avatar Hyan Mandian avatar N Peruch avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.