26
KUBERNETES OPERATORS State of the Operators: Framework, SDKs, and Beyond Rob Szumski Product Manager, OpenShift

KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

KUBERNETES OPERATORS

State of the Operators: Framework, SDKs, and Beyond

Rob SzumskiProduct Manager, OpenShift

Page 2: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

OpenShift Commons @ Summit 20192

KUBERNETES ADOPTION PHASES

1. Stateless apps

ReplicaSets

Deployments

2. Stateful apps

StatefulSets

Storage/CSI

3. Distributed systems

Data rebalancing

Autoscaling

Seamless upgrades

Page 3: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

OpenShift Commons @ Summit 20193

KUBERNETES ADOPTION PHASES

1. Stateless apps

ReplicaSets

Deployments

2. Stateful apps

StatefulSets

Storage/CSI

3. Distributed systems

Data rebalancing

Autoscaling

Seamless upgrades

Page 4: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

OpenShift Commons @ Summit 20194

KUBERNETES ADOPTION PHASES

1. Stateless apps

ReplicaSets

Deployments

2. Stateful apps

StatefulSets

Storage/CSI

3. Distributed systems

Data rebalancing

Autoscaling

Seamless upgrades

Page 5: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

OpenShift Commons @ Summit 20195

WHAT IS AN OPERATOR?

Embed ops knowledge from the experts

Operator v1.1.2 DeploymentsStatefulSetsAutoscalers

SecretsConfig maps

Page 6: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

OpenShift Commons @ Summit 20196

Flexible apparchitectures

Uniform deployand debug

No reinventionof core concepts

Truly hybrid

OPERATORS FOR ALL

Page 7: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

YES, I WANT THAT!

How do I get it?

Page 8: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

For Builders and the community● Easily create application on Kubernetes via a common method● Provide standardized set of tools to build consistent apps

For application consumers and Kubernetes users● Keep used apps up to date for security and app lifecycle management● Consume Kube-native applications easily and correctly

Product Manager: Daniel Messer

Page 9: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

OpenShift Commons @ Summit 20199

https://github.com/operator-framework

Build Run Operate

Page 10: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

OPERATOR MATURITY MODELPhase I Phase II Phase III Phase IV Phase V

Basic Install

Automated application provisioning and configuration management

Seamless Upgrades

Patch and minor version upgrades supported

Full Lifecycle

App lifecycle, storage lifecycle (backup, failure recovery)

Deep Insights

Metrics, alerts, log processing and workload analysis

Auto Pilot

Horizontal/vertical scaling, auto config tuning, abnormal detection, scheduling tuning

Page 11: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

OPERATOR SDK

Go SDKAnsible SDKHelm SDK

“No code” Operator Perfect for Ops Full power & features

Testing framework

Verification & Scorecard

● “No code” improvements to Helm SDK user experience

● Testing is extremely important for Operators, we have a testing framework built in

● SDK includes a “scorecard” to ensure your Operator is technically correct

OperatorHub

Product Manager: Daniel Messer

Page 12: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

12

HELM SDK● Easiest way to get started – “no code”● Use templating from Helm● Connect values.yaml to Kubernetes object

$ operator-sdk new tomcat-operator --type=helm --helm-chart=stable/tomcat

Page 13: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

13

HELM SDKContainer Build

Tomcat Chartchart.yaml

Operator Containerv1.2.7 chart Tomcat Object

apiVersion: apache.org/v1kind: Tomcatmetadata: name: prod-1.2.7 Namespace: productionspec: replicaCount: 10 maxActiveSessions: 1000

Running Operatorv1.2.7

$ oc get Tomcats --all-namespacesNAMESPACE NAME READY STATUS RESTARTS AGEproduction prod-1.2.7 1/1 Running 0 4dstaging staging-v1.2.8 1/1 Running 1 2h

Page 14: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

14

ANSIBLE SDK● Run Ansible playbooks in an

Operator fashion● Great for Ops teams that aren’t

traditional devs● Takes the human out of the loop● Connects the playbooks to

Kubernetes events like Node failures

Container Build

AnsiblePlaybooks

Operator Containerv1.2.7

Tomcat ObjectapiVersion: apache.org/v1kind: Tomcatmetadata: name: prod-1.2.7 Namespace: productionspec: replicaCount: 10 maxActiveSessions: 1000

Running Operatorv1.2.7

$ oc get Tomcats --all-namespacesNAMESPACE NAME READY STATUS RESTARTS AGEproduction prod-1.2.7 1/1 Running 0 4dstaging staging-v1.2.8 1/1 Running 1 2h

PlaybookMapping

Page 15: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

15

GO SDK● Best way to get to a Level 5 “Auto Pilot” Operator● Use the same tools Kubernetes developers use upstream● Popular for database & storage vendors● Built-in testing framework

if tomcats.length != desired { //initial deployment}

foreach tomcats as tomcat { if tomcat.Spec.Replicas != size { //fix size }}

Page 16: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

16

OPERATORS ACROSS THE INDUSTRY

Lower barrier to entryDon’t have to be an expert in $X

Page 17: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

17

Page 18: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

18

BREAKING DOWN AN OPERATOR

Embed ops knowledge from the experts

Operator v1.1.2 DeploymentsStatefulSetsAutoscalers

SecretsConfig maps

Page 19: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

19

BREAKING DOWN AN OPERATOR

Cluster actions● Install the CRDs and make sure nothing else owns those CRDs● Verify dependent CRDs exist

Run the Operator(s)● Pull and run the container as a Deployment● Watch the correct namespaces with a Service Account

Permissions● Minimal set of permissions to function● Bind those to the Service Account

Page 20: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

20

BREAKING DOWN AN OPERATOR

Cluster actions● Install the CRDs and make sure nothing else owns those CRDs● Verify dependent CRDs exist

Run the Operator(s)● Pull and run the container as a Deployment● Watch the correct namespaces with a Service Account

Permissions● Minimal set of permissions to function● Bind those to the Service Account

apiVersion: operators.coreos.com/v1alpha1kind: ClusterServiceVersion…customResourceDefinitions: owned: … required: …install: strategy: Deployment clusterPermissions: … permissions: … spec: deployments: …

Page 22: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

22

SELF-SERVICE FOR ENGINEERS

apiVersion: mongodb.com/v1kind: MongoDbReplicaSetmetadata: name: example namespace: productionspec: members: 3 version: 4.0.2 persistent: false project: example credentials: my-secret

Page 23: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

23

SIMPLER GITOPS FOR ENGINEERS

apiVersion: mongodb.com/v1kind: MongoDbReplicaSetmetadata: name: example namespace: productionspec: members: 3 version: 4.0.2 persistent: false project: example credentials: my-secret

apiVersion: mongodb.com/v1kind: CustomFrontendmetadata: name: frontend namespace: productionspec: database-name: example highly-available: true resources: cores: 1 memory: 1024

DeploymentsStatefulSetsAutoscalers

SecretsConfigMaps

Service AccountsLimits/Quotas

PersistentVolumes

Page 24: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

24

FULL CONTROL FOR ADMINS

Page 25: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

TRY IT OUT

https://github.com/operator-framework/getting-started

https://commons.openshift.org/sig/operators.html

https://www.operatorhub.io

Page 26: KUBERNETES OPERATORS€¦ · 2 OpenShift Commons @ Summit 2019 KUBERNETES ADOPTION PHASES 1. Stateless apps ReplicaSets Deployments 2. Stateful apps StatefulSets Storage/CSI 3. Distributed

Panel: Operators in Action

● Nestor Salceda Alonso - Sysdig● Annette Clewett - Red Hat● Denis Rosa - Couchbase● Marc Brugger - SIX● Matthias Luebken -Instana● Balaji Sivasubramanian - OpsMx