Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Kubernetes By Example http://bit.ly/kubernetesbyexample
<section data-background-transition="none-in zoom-out" data-transition="zoom" id="KBE" data-background-color="black">
<h1 style="color:white;padding-top:26%;">Kubernetes</h1>
<h2 style="color:white;">By Example</h2>
<p class='fragment grow'><a style="font-weight:bold;" href="http://bit.ly/kubernetesbyexample">bit.ly/kubernetesbyexample</a></p>
<!--<p><a href="https://www.socallinuxexpo.org/scale/18x/presentations/workshop-kubernetes-101">Thursday, March 5, 2020 - 14:00 to 17:00, Room 106</a></p> -->
</section>
<section data-transition='convex'>
<section id='introduction'>
<h1>Introduction</h1>
</section>
<section id='survey'>
<h3>Intro Survey / Who are you?</h3>
<ol>
<li class='fragment'>do you have any experience using containers?</li>
<li class='fragment'>do you have any experience using Kubernetes?</li>
<li class='fragment'>do you consider yourself to be proficient with the <code>oc</code> or <code>kubectl</code> cli tools?</li>
<li class='fragment'>can you name five basic Kubernetes resource types?</li>
</ol>
</section>
</section>
<section>
<section data-transition='convex' id='agenda'>
<h2>Workshop Agenda</h2>
<ul style='list-style: none;'>
<li class='fragment'><a href="#/introduction">Introduction</a>
<ul style='list-style: none;'>
<li class='fragment'><a href="#/agenda">Agenda</a></li>
<li class='fragment'><a href="#/kubernetes">Overview</a></li>
<li class='fragment'><a href="#/cluster-access">Environment Setup</a></li>
</ul>
</li>
<li class='fragment'><a href="#/kubernetes-basics">Kubernetes Basics</a>
<ul style='list-style: none;'>
<li class='fragment'>Learn five basic resource types</li>
</ul>
</li>
<li class='fragment'><a href="#/wrap-up">Wrap Up / Q&amp;A</a></li>
</ul>
</section>
<section id='kubernetes' data-markdown>
# 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
</section>
<section id='openshift' data-markdown>
# OpenShift
* a CNCF certified distribution of Kubernetes
* adds: Multi-tenant security, PaaS-style workflows, a container registry, distributed metrics and logs ...
</section>
<section id='more-info'>
<h3>More Information</h3>
<ul>
<li>Kubernetes Sources and Official Releases:<br/>
<a href="http://github.com/kubernetes/kubernetes">http://github.com/kubernetes/kubernetes</a></li>
<li>Kubernetes Docs: <a href="http://kubernetes.io/docs/home/">http://kubernetes.io/docs/home/</a></li>
<li>OpenShift Sources and Official Releases:<br/>
<a href="http://github.com/openshift/origin/">http://github.com/openshift/origin/</a></li>
<li>OpenShift Docs: <a href="https://docs.openshift.com/">https://docs.openshift.com/</a></li>
</ul>
</section>
</section>
<section>
<section id='workshop-requirements' data-markdown>
## Workshop Requirements
choose one:
* kubernetesbyexample.com/diy
* learn.openshift.com
</section>
</section>
<!--
<section id='cluster-access' data-markdown>
## Cluster Access
1. Select an available username for today's lab: http://bit.ly/pick-username
2. Add your name in the column to the right to indicate that you have claimed the account name
3. Sign in with your selected username ("userN") and a password of "openshift" at:
https://lab-k8s-101-workshops.apps.cluster-scale-ab86.scale-ab86.example.opentlc.com
</section>
-->
<section>
<section data-transition='zoom-in convex-out' id='ready'>
<h1><i>Ready?</i></h1>
</section>
<section data-background-transition="zoom">
<h1>Set?</h1>
<div class='fragment fade-up'>
<p>Verify that your cli tools are configured to connect to your Kubernetes environment:<br/>
<pre><code contenteditable>kubectl version</code></pre>
<p>The output should include your <code>kubectl</code> version info, and the release version of the kubernetes API server (when available)</p>
</div>
</section>
<section data-background-transition="zoom">
<h1><i>Let's Go!</i></h1>
</section>
</section>
<section>
<section id='kubernetes-basics'>
<h1>Kubernetes Basics</h1>
<p></p>
</section>
<section data-markdown>
## 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
</section>
<section id='an-api' data-markdown>
Kubernetes provides&hellip;
# 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/
</section>
<section data-transition="linear" id='terminology' data-markdown>
### K8s Terminology
0. namespace
1. [pod](#/po)
2. labels
3. [deployment](#/deployment)
2. [service](#/svc)
</section>
</section>
<section>
<!--
<section>
<p>Try using <code>kubectl</code> to list resources by type:</p>
<pre><code contenteditable>kubectl get nodes</code></pre>
<p class='fragment'>Given OpenShift's RBAC policies, only users with administrative credentials will have sufficient privledges to list nodes in the cluster. (Instuctors may optionally log in as cluster-admin to fetch the list of nodes)</p>
</section>
<section data-markdown>
### Observations:
* Your processes run on Nodes! (machines)
* Kubernetes actively manages process availability and health over groups of machines (distributed system)
* built for high availability (of platform, of workloads)
* Scale out by adding more Nodes to the pool
* RBAC policies can be applied, protecting access to privledged platform state (stored in etcd)
</section>
-->
</section>
<section>
<section data-transition="linear" id='po' data-markdown>
### Pods
A group of one or more co-located containers. Pods represent your minimum increment of scale.
http://kubernetesbyexample.com/pods
</section>
<section data-markdown>
### 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
</section>
<!--
<section data-markdown>
</section>
-->
</section>
<section data-transition="linear" id='svc' data-markdown>
### Labels
Key,value pairs can be used as selectors for targeting groups of resources on the API
http://kubernetesbyexample.com/pods
</section>
<section>
<section data-transition="linear" id='deployment' data-markdown>
### Deployments
A `deployment` helps you specify container runtime requirements (in terms of pods)
</section>
<section data-markdown>
### 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`
</section>
</section>
<section>
<section data-transition="linear" id='svc' data-markdown>
### 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
</section>
<section data-markdown>
### 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
</section>
</section>
<section id='exit-survey'>
<h3>Part 1 - Exit Survey</h3>
<ol>
<li class='fragment'>have experience using containers?</li>
<li class='fragment'>have experience using Kubernetes?</li>
<li class='fragment'>Do you consider yourself to be basically proficient with the <code>oc</code> or <code>kubectl</code> command-line tools?</li>
<li class='fragment'>What resource type represents our minimum unit of scale?</li>
<li class='fragment'>What resource type is most similar to a loadbalancer?</li>
<li class='fragment'>What resource type is responsible for replication?</li>
<li class='fragment'>What resource type provides zero-downtime rollouts and rollbacks?</li>
<li class='fragment'>Can you name five basic Kubernetes primitives or resource types?</li>
</ol>
</section>
<section>
<section data-markdown>
## Resources
</section>
<section data-markdown>
### Free O'Reilly Ebook
[Kubernetes Operators](https://www.openshift.com/kubernetes-operators/) *NEW!*
</section>
<!--
<section data-markdown>
### Kubernetes SIGs
[Kubernetes Special Interest Groups (SIGs)](https://github.com/kubernetes/community/blob/master/sig-list.md)
</section>
-->
</section>
<section id='try-openshift' data-markdown>
### OpenShift
* [OperatorHub.io](http://OperatorHub.io)
* [learn.openshift.com](http://learn.openshift.com)
* [openshift.com/try](https://openshift.com/try)
</section>
<section data-background-color='black' id='q-and-a'>
<h1 style='color:white;'>Q&amp;A</h1>
</section>
<section id='thank-you' data-background-color="black">
<h1 style='color:white;'>Thank You!</h1>
<h3 class="fragment grow" style='text-transform:none;'><a href="http://bit.ly/kubernetesbyexample">bit.ly/kubernetesbyexample</a></h3>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment