Copyright © 2018 The Kyma project authors.
Kubernetes extensibility
with Custom Resources
Piotr Bochyński
Copyright © 2018 The Kyma project authors.
Agenda
Kubernetes API
Custom Resources & Custom
Resource Definitions
Controllers
Real World Use Cases
Lambdas (serverless functions)
Service Mesh (istio)
Service Catalog & Bindings (declarative
connection to the service)
Copyright © 2018 The Kyma project authors.
Kubernetes API
A resource is an endpoint in the Kubernetes API that stores a collection of API
objects of a certain kind. Examples:
• deployments
• pods
• services
You can add new custom resource using:
• CRDs (simple)
• API Aggregation (more complex, but allows more control over API behaviors like
how data is stored and conversion between API versions)
Copyright © 2018 The Kyma project authors.
Custom Resources
A custom resource is an extension of the Kubernetes API that is not necessarily available
on every Kubernetes cluster.
The CustomResourceDefinition API resource allows you to define custom resources.
Defining a CRD object creates a new custom resource with a name and schema that you
specify.
The Kubernetes API serves and handles the storage of your custom resource.
Copyright © 2018 The Kyma project authors.
Custom Resources
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: foos.samplecontroller.k8s.io
spec:
group: samplecontroller.k8s.io
version: v1alpha1
names:
kind: Foo
plural: foos
scope: Namespaced
validation:
openAPIV3Schema:
properties:
spec:
properties:
replicas:
type: integer
minimum: 1
maximum: 10
apiVersion: samplecontroller.k8s.io/v1alpha1
kind: Foo
metadata:
name: example-foo
spec:
deploymentName: example-foo
replicas: 1
Copyright © 2018 The Kyma project authors.
DEMO – create custom
resource
Copyright © 2018 The Kyma project authors.
Controllers
Custom resources without controllers are rather useless.
You need some logic.
Controllers use reconcilliation loop pattern
Copyright © 2018 The Kyma project authors.
Controllers
Kubernetes provide tools to simplify development of controllers
Copyright © 2018 The Kyma project authors.
kubernetes/sample-controller
DEMO & quick walk through
Copyright © 2018 The Kyma project authors.
Real World Use Cases
Lambdas - Kubeless
• Kubeless is a serverless engine designed for kubernetes
• Function is defined as Custom Resource
• Function can be triggered by http request or event
Service Mesh – Istio
• Traffic controll (incoming, internal and outgoing)
• Security
• Monitoring and tracing
Copyright © 2018 The Kyma project authors.
Copyright © 2018 The Kyma project authors.
DEMO: create Custom resources
for lambda function and API
Copyright © 2018 The Kyma project authors.
Service Binding
Copyright © 2018 The Kyma project authors.
Alternatives
• https://github.com/kubernetes-
sigs/kubebuilder
• https://github.com/operator-
framework/operator-sdk
Copyright © 2018 The Kyma project authors.Copyright © 2018 The Kyma project authors.
WANT MORE?
Copyright © 2018 The Kyma project authors.
What is Kyma?
Kyma is a cloud-native application development framework.
It provides the last mile capabilities that a developer needs
to build a cloud-native application using several open-source
projects such as Kubernetes, Istio, NATS, Kubeless, and
Prometheus, to name a few.
It is designed natively on Kubernetes and, therefore,
it is portable to all major cloud providers.
Copyright © 2018 The Kyma project authors.
Thank you
Piotr Bochynski
twitter: @pbochynski
mail: piotr.bochynski@sap.com

Extending kubernetes - kyma template

  • 1.
    Copyright © 2018The Kyma project authors. Kubernetes extensibility with Custom Resources Piotr Bochyński
  • 2.
    Copyright © 2018The Kyma project authors. Agenda Kubernetes API Custom Resources & Custom Resource Definitions Controllers Real World Use Cases Lambdas (serverless functions) Service Mesh (istio) Service Catalog & Bindings (declarative connection to the service)
  • 3.
    Copyright © 2018The Kyma project authors. Kubernetes API A resource is an endpoint in the Kubernetes API that stores a collection of API objects of a certain kind. Examples: • deployments • pods • services You can add new custom resource using: • CRDs (simple) • API Aggregation (more complex, but allows more control over API behaviors like how data is stored and conversion between API versions)
  • 4.
    Copyright © 2018The Kyma project authors. Custom Resources A custom resource is an extension of the Kubernetes API that is not necessarily available on every Kubernetes cluster. The CustomResourceDefinition API resource allows you to define custom resources. Defining a CRD object creates a new custom resource with a name and schema that you specify. The Kubernetes API serves and handles the storage of your custom resource.
  • 5.
    Copyright © 2018The Kyma project authors. Custom Resources apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: foos.samplecontroller.k8s.io spec: group: samplecontroller.k8s.io version: v1alpha1 names: kind: Foo plural: foos scope: Namespaced validation: openAPIV3Schema: properties: spec: properties: replicas: type: integer minimum: 1 maximum: 10 apiVersion: samplecontroller.k8s.io/v1alpha1 kind: Foo metadata: name: example-foo spec: deploymentName: example-foo replicas: 1
  • 6.
    Copyright © 2018The Kyma project authors. DEMO – create custom resource
  • 7.
    Copyright © 2018The Kyma project authors. Controllers Custom resources without controllers are rather useless. You need some logic. Controllers use reconcilliation loop pattern
  • 8.
    Copyright © 2018The Kyma project authors. Controllers Kubernetes provide tools to simplify development of controllers
  • 9.
    Copyright © 2018The Kyma project authors. kubernetes/sample-controller DEMO & quick walk through
  • 10.
    Copyright © 2018The Kyma project authors. Real World Use Cases Lambdas - Kubeless • Kubeless is a serverless engine designed for kubernetes • Function is defined as Custom Resource • Function can be triggered by http request or event Service Mesh – Istio • Traffic controll (incoming, internal and outgoing) • Security • Monitoring and tracing
  • 11.
    Copyright © 2018The Kyma project authors.
  • 12.
    Copyright © 2018The Kyma project authors. DEMO: create Custom resources for lambda function and API
  • 13.
    Copyright © 2018The Kyma project authors. Service Binding
  • 14.
    Copyright © 2018The Kyma project authors. Alternatives • https://github.com/kubernetes- sigs/kubebuilder • https://github.com/operator- framework/operator-sdk
  • 15.
    Copyright © 2018The Kyma project authors.Copyright © 2018 The Kyma project authors. WANT MORE?
  • 16.
    Copyright © 2018The Kyma project authors. What is Kyma? Kyma is a cloud-native application development framework. It provides the last mile capabilities that a developer needs to build a cloud-native application using several open-source projects such as Kubernetes, Istio, NATS, Kubeless, and Prometheus, to name a few. It is designed natively on Kubernetes and, therefore, it is portable to all major cloud providers.
  • 17.
    Copyright © 2018The Kyma project authors. Thank you Piotr Bochynski twitter: @pbochynski mail: piotr.bochynski@sap.com