Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to Teach Old Apps New Tricks with Ansible-based Operators (Parts 1 & 2)

How to Teach Old Apps New Tricks with Ansible-based Operators (Parts 1 & 2)

At Red Hat Summit this year, I had the task of explaining Kubernetes Operators with Ansible in two, fifteen-minute talks, separated by three hours, in the middle of the busy Red Hat booth to literally anyone that walked up. I had to explain Kubernetes, the difference stateful and stateless apps, what a Kubernetes Operator is, how to write an operator with Ansible, and then demonstrate this capability. Use of video and sound was discouraged. Also, there wasn't going to be an ethernet cable available meaning only conference show floor WiFi was available for a demo. Read more at chrisshort.net

Chris Short

May 08, 2019
Tweet

More Decks by Chris Short

Other Decks in Technology

Transcript

  1. How to Teach Old Apps New Tricks with Ansible-based Operators:

    Part 1 Chris Short Principal Product Marketing Manager 2019-05-08 @ChrisShort
  2. PART ONE • What is Kubernetes? • Containers and State

    • What’s an Operator? • Ansible-based Operators
  3. WHAT IS KUBERNETES? “Kubernetes (k8s) is an open-source system for

    automating deployment, scaling, and management of containerized applications.” https://kubernetes.io/
  4. ENTERPRISE KUBERNETES Red Hat® OpenShift® Container Platform offers enterprises full

    control over their Kubernetes environments, whether they’re on-premise or in the public cloud. https://www.openshift.com/
  5. KUBERNETES OPERATORS Kubernetes Operators encode the human knowledge required to

    install, upgrade / patch, recover from failure, and tune applications and services. https://github.com/operator-fram ework/operator-sdk
  6. OPERATORS MANAGE STATE Declare operational knowledge from experts as code

    Operator SDK Deployments StatefulSets Autoscalers Secrets Config maps
  7. --- apiVersion: apps/v1 kind: Deployment metadata: name: motd-operator spec: replicas:

    1 selector: matchLabels: name: motd-operator template: metadata: ... YAML: YEAH YOU KNOW ME! k8s-deployment.yaml ansible-task.yml --- - name: Save the STATE copy: dest: /motd.timestamp src: /etc/motd owner: root group: root mode: 0644 remote_src: true ...
  8. The Ansible Kubernetes module enables the Operator SDK to utilize

    Ansible and its ecosystem to manage applications inside Kubernetes and OpenShift OPERATOR SDK ANSIBLE
  9. OPERATOR CAPABILITY LEVEL Phase 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
  10. How to Teach Old Apps New Tricks with Ansible-based Operators:

    Part 2 Chris Short Principal Product Marketing Manager 2019-05-08 @ChrisShort
  11. PART TWO • Part One Recap • Ansible-based Operators in

    Kubernetes • How Can Ansible-based Operators Bring Apps To Openshift • Resources
  12. BUILD ANSIBLE-BASED OPERATOR # operator-sdk new motd-operator --type ansible --api-version

    motd.example.com/v1 --kind MOTD # cd motd-operator # oc create -f deploy/crds/motd_v1_motd_crd.yaml
  13. BUILD ANSIBLE-BASED OPERATOR # vi build/Dockerfile RUN ansible-galaxy install chris-short.ansible_role_motd

    # operator-sdk build quay.io/chrisshort/motd-operator:v0.0.1 # podman push quay.io/chrisshort/motd-operator:v0.0.1
  14. DEPLOY ANSIBLE-BASED OPERATOR # oc create -f deploy/service_account.yaml # oc

    create -f deploy/role.yaml # oc create -f deploy/role_binding.yaml # oc create -f deploy/operator.yaml
  15. ANSIBLE ECOSYSTEM Red Hat® Ansible® Automation is a universal language,

    unraveling the mystery of how work gets done. Turn tough tasks into repeatable playbooks. Ansible is an open source community project sponsored by Red Hat, it's the simplest way to automate IT. Ansible is the only automation language that can be used across entire IT teams from systems and network administrators to developers and managers.
  16. OPERATOR ECOSYSTEM OperatorHub.io: OperatorHub.io is a new home for the

    Kubernetes community to share Operators. Find an existing Operator or list your own today. learn.openshift.com: Our Interactive Learning Scenarios provide you with a pre-configured OpenShift® instance, accessible from your browser without any downloads or configuration. Operator Framework: An open source toolkit to manage Kubernetes native applications, called operators, in an effective, automated, and scalable way.
  17. ARTIFACTS https://github.com/chris-short/ansible-role-motd: Ansible Role to manage /etc/motd to simulate managing

    state https://galaxy.ansible.com/chris-short/ansible_role_motd: Above Ansible Role available from Ansible Galaxy https://github.com/chris-short/motd-operator: Ansible-based Kubernetes Operator Using ansible_role_motd from Ansible Galaxy as an example from managing state in a Kubernetes cluster