Kubernetes

By Example

bit.ly/kubernetesbyexample

Introduction

Intro Survey / Who are you?

  1. do you have any experience using containers?
  2. do you have any experience using Kubernetes?
  3. do you consider yourself to be proficient with the oc or kubectl cli tools?
  4. can you name five basic Kubernetes resource types?

Workshop Agenda

# Kubernetes * [is](https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/): an ops tool; a collection of APIs for managing container-based workloads * [is not](https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/#what-kubernetes-is-not): a PaaS
# OpenShift * a CNCF certified distribution of Kubernetes * adds: Multi-tenant security, PaaS-style workflows, a container registry, distributed metrics and logs ...

More Information

## Workshop Requirements choose one: * kubernetesbyexample.com/diy * learn.openshift.com

Ready?

Set?

Verify that your cli tools are configured to connect to your Kubernetes environment:

kubectl version

The output should include your kubectl version info, and the release version of the kubernetes API server (when available)

Let's Go!

Kubernetes Basics

↓

## etcd ![etcd logo](https://raw.githubusercontent.com/coreos/etcd/master/logos/etcd-glyph-color.png) * developed at CoreOS, donated to the CNCF * distributed key-value store with automatic leader election * implements the [RAFT](https://raft.github.io/raft.pdf) consensus protocol * CAP theorum: [CAP twelve years later](https://www.infoq.com/articles/cap-twelve-years-later-how-the-rules-have-changed) http://play.etcd.io/play
Kubernetes provides… # An API API object primitives include the following attributes: ``` kind apiVersion metadata spec status ``` *mostly true Extended Kubernetes API Reference: http://k8s.io/docs/reference/generated/kubernetes-api/v1.17/
### K8s Terminology 0. namespace 1. [pod](#/po) 2. labels 3. [deployment](#/deployment) 2. [service](#/svc)
### Pods A group of one or more co-located containers. Pods represent your minimum increment of scale. http://kubernetesbyexample.com/pods
### Observations: * API resources provide declarative specifications with asyncronous fulfilment of requests * see `spec` vs `status` * automated health checking for PID1 in each container * Pods are scheduled to be run on nodes * The API ambidextriously supports both json and yaml
### Labels Key,value pairs can be used as selectors for targeting groups of resources on the API http://kubernetesbyexample.com/pods
### Deployments A `deployment` helps you specify container runtime requirements (in terms of pods)
### Observations: * Use the `--dry-run` flag to generate new resource specifications * A deployment spec contains a pod spec in it's "template" element * The API provides `edit` and `watch` operations in addition to `get`, `set`, and `list`
### Services Services (svc) establish a single endpoint for a collection of replicated pods, distributing traffic based on label selectors In our K8s modeling language they represent a load balancer. Their implementation may vary per cloud provider
### Observations: * *"service"* basically means *"loadbalancer"* * Label selectors can be used to organize workloads and manage groups of related resouces * The Service resource uses label selectors to discover where traffic should be directed * Pods and Services exist independently, have disjoint lifecycles

Part 1 - Exit Survey

  1. have experience using containers?
  2. have experience using Kubernetes?
  3. Do you consider yourself to be basically proficient with the oc or kubectl command-line tools?
  4. What resource type represents our minimum unit of scale?
  5. What resource type is most similar to a loadbalancer?
  6. What resource type is responsible for replication?
  7. What resource type provides zero-downtime rollouts and rollbacks?
  8. Can you name five basic Kubernetes primitives or resource types?
## Resources
### Free O'Reilly Ebook [Kubernetes Operators](https://www.openshift.com/kubernetes-operators/) *NEW!*
### OpenShift * [OperatorHub.io](http://OperatorHub.io) * [learn.openshift.com](http://learn.openshift.com) * [openshift.com/try](https://openshift.com/try)

Q&A

Thank You!

bit.ly/kubernetesbyexample

Runs on Kubernetes Presented by: @ryanj