This slide deck demonstrates the latest releases of Kubeless and Ballerina and shows how to develop and run Ballerina functions on Kubernetes with Kubeless.
Webinar: https://ballerina.io/learn/events/webinars/ballerina-serverless-with-kubeless/
2. Ballerina is a cloud-native,
compiled, type safe, concurrent
programming language.
3. Code, not config, with text & graphical syntax
● Full language
service<http:Service> echo bind ep {
@http:ResourceConfig {
methods: ["GET"],
path: "/sayHello",
authConfig: {
scopes: ["scope2"]
}
}
hello(endpoint caller, http:Request req) {
● Annotations for security, deployment, etc.
● Equivalent text and graphic syntax
function main (string... args) {
worker w1 {
io:println("Hello, World! #m");
}
worker w2 {
io:println("Hello, World! #n");
}
worker w3 {
io:println("Hello, World! #k");
}
}
@kubernetes:Deployment {
image: "demo/ballerina-demo",
name: "ballerina-demo"
}
@kubernetes:ConfigMap{
ballerinaConf: "twitter.toml"
}
service<http:Service> hello bind listener {
4. Network-oriented
○ Endpoints and services
○ Explicit local vs remote calls syntax
○ Data types include native JSON and XML
○ Native support for streams, events, stream queries
○ Support for all modern protocols: HTTP2, WebSockets, gRPC, etc.
○ Type safety and type matching
○ Distributed resilience
5. Secure by design
○ Runtime context with principal and permissions set by inbound endpoints
○ Pluggable authentication and authorization framework
○ Taint assertions and checking
6. Ecosystem-friendly
○ Open source
○ Package management built-in / Ballerina Central
○ Extensible compiler
○ Language Server Protocol (LSP) implementation for IDEs
○ Can be built directly into Docker and Kubernetes artifacts
○ Observability interfaces
13. Functions as a Service / Serverless
13
Unit of deployment is a function
Somewhere in the PaaS spectrum
• Not pushing code a la git push
• Not running fully baked containers
• Transparent infrastructure, scaling, networking
• Fine grained cost management
• Source to production
“Reduce MTTP: Mean Time To Production or MTTD …” Operating system
Runtime
functiona()
functionb()
...
Your program
14. Why Kubernetes?
14
• Production-grade orchestration system
• Infrastructure as code
• Suited for microservice architectures
• Easily extendable to build abstractions/APIs on top
15. Deploy a function
15
$ kubeless function deploy hello
--runtime ballerina0.975.0
--handler hello.foo
--from-file helloget.bal
import kubeless/kubeless;
public function foo(
kubeless:Event event,
kubeless:Context context)
returns (string|error)
{
return "Hello World Ballerina";
}
18. Kubeless
New in Version 1.0.0
https://github.com/kubeless/kubeless/releases
• Language support expanded to include Ballerina and
Golang –
in addition to Python, Node.js and Ruby
• Docker images supported as compiled language
• Event triggers using Kafka and CNCF nats.io
• Sysdig Falco integration for security and monitoring
• https://kubeless.io/docs/implementing-new-runtime/
Extend with Runtimes
19. How to get involved
Learn more
Open source
Get support
http://ballerina.io
http://kubeless.io
http://github.com/ballerina-platform/
http://github.com/kubeless/kubeless
Stack Overflow #ballerina tag
https://ballerina.io/open-source/slack/
http://slack.kubernetes.io #kubeless