Skip to content

Instantly share code, notes, and snippets.

@ryanj
Last active June 2, 2018 13:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanj/ffe18756fd494ffd131e02abd51c4650 to your computer and use it in GitHub Desktop.
Save ryanj/ffe18756fd494ffd131e02abd51c4650 to your computer and use it in GitHub Desktop.
Developing Locally with Kubernetes from #Kubecon2017 in Austin, TX http://bit.ly/kubecon-dev
<section>
<section id="at-Kubecon-2017">
<img style="width:100%" src="https://i.imgur.com/znrD3yq.jpg" alt="Developing Locally with Kubernetes - http://bit.ly/kubecon-dev" />
<br/>
<a href="https://youtu.be/_W6O_pfA00s">youtu.be/_W6O_pfA00s</a>
</section>
<section data-background-transition='fade' data-background='black' id='presented-by-ryanj'>
<p>presented by <a href="http://twitter.com/ryanj/">@ryanj</a>, Developer Advocate at Red Hat</p>
<p class='fragment fade-up'><a href="http://twitter.com/ryanj/"><img alt="ryanj" src="http://ryanjarvinen.com/images/ryanj-mestrefungo-com.gif" style="width:48%"/></p>
</section>
</section>
<!--
<section data-markdown>
</section>
-->
<section data-background='black' data-markdown id="the-community-is-terrible-at">
The Kubernetes Community is Terrible at Pitching Kubernetes to Developers
</section>
<section data-background='black' data-transition='zoom' id='why' data-markdown>
## Why?
</section>
<section data-markdown id='kubernetes-is'>
# Kubernetes
(an ops tool)
</section>
<section data-transition='fade-out' id='prescription'>
<img src="https://i.imgur.com/XlhSc6W.jpg"/>
</section>
<section data-transition='fade-in zoom-out' id='prescription-k8s'>
<img src="https://i.imgur.com/7BVLtPU.jpg"/>
</section>
<section data-transition='zoom-in convex-out' id='for-operations'>
<p>When used as directed, provides relief for the following:</p>
<ol>
<li class='fragment'>standardized terminology &amp; packaging - containers, volumes, podspecs, charts</li>
<li class='fragment'>load balancing - services</li>
<li class='fragment'>scaling automation - replica sets</li>
<li class='fragment'>delivery automation - deployments</li>
<li class='fragment'>high availability - automated health checking and replacement</li>
<li class='fragment'>distributed scheduling and resource management - RBAC, namespaces, labels, federation</li>
<li class='fragment'>???</li>
</ol>
</section>
<section data-transition='zoom' id='k8s-logo'>
<a href="http://kubernetes.io/"><img src="https://cdn.rawgit.com/ryanj/1aed9676c69ab0073be0beb60ca77a9c/raw/74f82bdfb47f1addaca529e8ee63ed678356a62f/kubernetes-blueprint-logo.svg" alt="kubernetes" style='width:30%;'></a>
</section>
<section data-background='black' data-markdown id='meanwhile'>
meanwhile...
</section>
<section id='what'>
<p>What is an App?</p>
<ol>
<li class='fragment'><span style='text-decoration:line-through;'>repo code</span></li>
<li class='fragment'><span style='text-decoration:line-through;'>docker image</span></li>
<li class='fragment'>kubernetes spec files</li>
<li class='fragment'>charts</li>
<li class='fragment'>kubectl get all -l app=myapp -n mynamespace</li>
</ol>
<p class='fragment'><a href="https://docs.google.com/document/d/1EVy0wRJRm5nogkHl38fNKbFrhERmSL_CLNE4cxcsc_M/edit">Proposal: Label Recommendations</a></p>
</section>
<section data-transition='zoom' id='how' data-markdown>
### How should we be talking to Developers about
# Kubernetes?
</section>
<section data-background='black' id='why-k8s'>
<blockquote>
Q: Why Kubernetes?
</blockquote>
<div class='fragment' style='clear:both;'>
<blockquote>
A: Development Velocity
</blockquote>
</div>
</section>
<section data-transition="convex" id='welcome-to-Austin'>
<img src="http://mediad.publicbroadcasting.net/p/kut/files/201609/4764611735_3a22b13c0b_b.jpg" />
</section>
<section data-transition="concave" id='a-case-study'>
<h3>A Case Study: Enterprise Records, Inc.</h3>
<img class='fragment fade-up' src="https://i.imgur.com/KpTVDt4.jpg" />
</section>
<section data-transition="convex" id='pitching-k8s'>
<img src="https://i.imgur.com/NEMK0xw.gif" />
<p>The Ops team has heard great things about Kubernetes, and is interested in giving it a try - but they're having difficulty convincing other teams of the value</p>
</section>
<section id='focus-on-delivery'>
<p>Product team needs:</p>
<h1 class='fragment zoom'>More</h1>
<img class='fragment fade-up' src="https://i.imgur.com/q9rPpDn.gif" />
<p class='fragment zoom'>(always more)</p>
</section>
<section data-transition="zoom" id='dont-let-k8s-get-in-the-way'>
<img src="https://i.imgur.com/Bvq78UI.gif" />
<p>The web team is confused by all the new terminology, and is under a lot of pressure to focus on delivering new tracks to customers</p>
</section>
<section id='define-a-path-to-productivity'>
<img src="https://i.imgur.com/jGm2JJ0.gif" />
</section>
<section id='convince-the-team'>
<p>Convincing the team (minimal onboarding):</p>
<ol>
<li class='fragment'><a href="#/the-easy-part">Getting started is easy</a></li>
<li class='fragment'><a href="#/sharing">Share what you know (and model your I/O)</a></li>
<li class='fragment'><a href="#/choose-the-right-tools">Choose the right toolchain</a></li>
</ol>
</section>
<section id='the-easy-part' data-markdown>
# 1. The Easy Part
is
minikube start
</section>
<section data-markdown id='no-excuses'>
* Staging down?
* Ops not Ready?
No Excuses!
</section>
<section data-transition="zoom" data-markdown id='kubernetes-all-the-things'>
# !!Everyone get a K8s!!
</section>
<section data-transition='zoom' id='k8s-delivery'>
<a href="http://kubernetes.io/"><img src="https://cdn.rawgit.com/ryanj/1aed9676c69ab0073be0beb60ca77a9c/raw/74f82bdfb47f1addaca529e8ee63ed678356a62f/kubernetes-blueprint-logo.svg" alt="kubernetes" style='width:30%;'></a>
</section>
<section id='minikube'>
<h2>Minikube</h2>
<p><a href="https://github.com/kubernetes/minikube"><img style="width:30%;" src="https://raw.githubusercontent.com/kubernetes/minikube/master/logo/logo.png" /></a></p>
<ul>
<li><a href="https://github.com/kubernetes/minikube">Minikube Docs</a></li>
<li><a href="http://bit.ly/k8s-minikube">bit.ly/k8s-minikube</a></li>
</ul>
</section>
<section id='sharing' data-markdown>
# 2. Share What You Know
and model your I/O
</section>
<section id='dry-run' data-markdown>
### Share What You Know `--dry-run`
Generate kubernetes `deployment` and `service` specifications, both named `metrics-review`:
```bash
kubectl run metrics-review --image=quay.io/ryanj/metrics-k8s \
--expose --port=2015 --service-overrides='{ "spec": { "type": "NodePort" } }' \
--dry-run -o yaml > metrics-review.yaml
```
</section>
<section data-markdown id='dry-run'>
### Share What You Know `--dry-run`
Test your generated spec:
```bash
kubectl create -f metrics-review.yaml
```
Minikube users will be able to open the resulting service in their browser by running:
```bash
minikube service metrics-review
```
</section>
<section data-markdown id='i-o'>
## Model Your I/O
</section>
<section data-markdown id='example'>
### Example Repo
Create a local clone of this `metrics-k8s` repo:
```bash
git clone http://github.com/ryanj/metrics-k8s
```
</section>
<section data-markdown id='minikube-mount'>
### Preview - local files
Next, share your local repo contents with minikube:
```bash
cd metrics-k8s
minikube mount $(pwd):/var/www/html
```
</section>
<section data-markdown id='hostpath'>
### Preview - hostPath
Then, produce a new deployment spec that includes (minimal) support for live development workflows:
1. `cp metrics-review.yaml metrics-dev.yaml`
2. replace `metrics-review` with `metrics-dev` (global)
2. Add a `hostPort` volume to access your local repo:
```diff
spec:
containers:
- image: quay.io/ryanj/metrics-k8s
name: metrics-dev
ports:
- containerPort: 2015
resources: {}
+ volumeMounts:
+ - mountPath: /var/www/html
+ name: metrics-src
+ volumes:
+ - name: metrics-src
+ hostPath:
+ path: /var/www/html
status: {}
```
</section>
<section data-markdown id='kubectl-create'>
### Share what you know
The resulting file should look just like the included [metrics-dev.yaml](https://raw.githubusercontent.com/ryanj/metrics-k8s/master/metrics-dev.yaml) file from the `metrics-k8s` git repo.
Try launching it with:
```bash
kubectl create -f metrics-dev.yaml
```
</section>
<section data-markdown id='rollout-test'>
### Share what you know - Rollout Testing
Eval this
```bash
minikube docker-env
```
to send newly-built images to minikube's docker daemon:
```bash
docker build .
```
</section>
<section data-markdown id='the-hard-part'>
# 3. The Hard Part
Keeping it simple, and choosing the right tools for the job
</section>
<section>
<img src="https://i.imgur.com/ogR1pSy.gif" />
</section>
<section>
<h4>The future is already here — it's just not very evenly distributed. (W.Gibson)</h4>
</section>
<!--
<section data-markdown>
### Pizza As A Service
https://twitter.com/jeffbarr/status/888169783044194304
*how much of your pipeline should be independently reproducible by developers?*
</section>
-->
<section id='adoption-path'>
<p>Typical container adoption path:</p>
<ol>
<li class='fragment'>docker</li>
<li class='fragment'>volumes, PVs</li>
<li class='fragment'>minikube</li>
<li class='fragment'>k8s modeling and scalability via spec files, pods, and other abstractions</li>
<li class='fragment'>charts, openshift templates, or hand-rolled manifest / spec templating</li>
<li class='fragment'>monocular, kubeapps, ServiceCatalog</li>
<li class='fragment'>PaaS?</li>
</ol>
</section>
<section id='draft'>
<h2>Draft</h2>
<p class='fragment'>Make it easy to get started</p>
<p><a href="https://draft.sh">draft.sh</a></p>
</section>
<section id='charts'>
<h2>Charts</h2>
<p class='fragment'>Share what you know</p>
<p><a href="https://github.com/kubernetes/charts">github.com/kubernetes/charts</a></p>
</section>
<section id='helm-tiller'>
<h2>Helm & Tiller</h2>
<p class='fragment'>Share more</p>
<p><a href="https://github.com/kubernetes/helm">github.com/kubernetes/helm</a></p>
</section>
<section id='brigade'>
<h2>Brigade and Kashti</h2>
<p class='fragment'>Build more</p>
<p><a href="http://brigade.sh/">brigade.sh</a></p>
</section>
<section id='fabric8'>
<h2>Fabric8</h2>
<p class='fragment'>Build more</p>
<p><a href="https://fabric8.io">fabric8.io</a></p>
</section>
<section id='telepresence'>
<h2>Telepresence</h2>
<p class='fragment'>Access more</p>
<p><a href="http://telepresence.io">telepresence.io</a></p>
</section>
<section id='minishift-oc'>
<h2>minishift and oc</h2>
<p class='fragment'>Security Enhanced Kubernetes</p>
<p><a href="https://github.com/minishift/minishift">github.com/minishift/minishift</a></p>
<p><a href="https://github.com/openshift/origin">github.com/openshift/origin</a></p>
</section>
<!--
<section data-markdown>
Bugs are more expesive to fix when discovered later
![https://www.whitesourcesoftware.com/wp-content/uploads/2015/10/graph2.jpg](cost of development)
Making the entire pipeline reproducible allows integration bugs to be found during local dev, lowering overall development costs, increasing velocity
https://www.nist.gov/sites/default/files/documents/director/planning/report02-3.pdf#table5-1
</section>
-->
<section id='easy'>
<img src="https://i.imgur.com/uJ67uFz.gif" />
<p>Easy, right?</p>
</section>
<section data-markdown id='learn-more'>
## More Learning Opportunities
1. Kubernetes.io Tutorials https://kubernetes.io/docs/tutorials/
2. Katacoda https://katacoda.com/courses/kubernetes
4. RyanJ's K8s-workshops http://bit.ly/k8s-workshops
3. Interactive learning for OpenShift: http://learn.openshift.com
</section>
<section id='next-steps'>
<p>Include the whole team:</p>
<ul>
<li class='fragment'>Developers: Want to get ahead? Model your I/O, and Share What You Know!</li>
<li class='fragment'>Architects: Figure out who owns manifest creation, maintanence, and distribution</li>
<li class='fragment'>QA folks: look forward to saying: "can't repro - works fine on my Kubernetes"</li>
<li class='fragment'>Ops: provide cloud resources grants to teams, make sure prod has enough IaaS, ensure platform uptime, upgrades, logging, and metrics</li>
<li class='fragment'>Security &amp; Compliance: RBAC, config and secrets management; Secret rotation policies; Monitor for CVEs and apply security patches from upstream</li>
</ul>
</section>
<section id='sig-apps'>
<p><a href="https://www.youtube.com/watch?v=vyYHfumJ-AM&list=PL69nYSiGNLP2LMq7vznITnpd2Fk1YIZF3"><img style="width:60%;" src="https://i.imgur.com/vibeqs6.png"/></a></p>
<p>Join the community on Slack in #kubernetes-users, and in #SIG-Apps!</p>
<p>Share What You Know: Help us develop a range of solutions that expose and/or hide kubernetes in appropriate ways</p>
</section>
<section id='deliver-consistently'>
<img src="https://i.imgur.com/GPNWcjN.gif" alt="delivering consistently" />
<p>Learn to deliver consistently using containers</p>
</section>
<section id='choose-the-right-tools'>
<img src="https://i.imgur.com/qvzFSaU.gif" />
<p>Choose the right tools for the job</p>
</section>
<section id='get-back-to-shipping-product'>
<img src="https://i.imgur.com/VgVLCPG.gif" alt="whole band" />
<p>then get back to making gold records</p>
</section>
<section id='thank-you'>
<h1>Thank You!</h1>
<p><a href="https://twitter.com/ryanj/status/943215666303180800">@RyanJ</a></p>
<p><a href="https://bit.ly/kubecon-dev">bit.ly/kubecon-dev</a></p>
<p><a href="https://youtu.be/_W6O_pfA00s">youtu.be/_W6O_pfA00s</a></p>
</section>
<!--
<section data-transition='concave'>
<section id="Developing-Locally-with-Kubernetes">
<h3>Developing Locally with</h3>
<h1>Kubernetes</h1>
<a href="http://kubernetes.io/"><img src="https://cdn.rawgit.com/ryanj/1aed9676c69ab0073be0beb60ca77a9c/raw/74f82bdfb47f1addaca529e8ee63ed678356a62f/kubernetes-blueprint-logo.svg" alt="kubernetes" style='width:17%;'></a>
<br/>
<p><a href="https://kccncna17.sched.com/mobile/#session:087f2cb57c336670fa23de4bf4f8c1ee">Thursday, December 7th 2:45 pm–3:20 pm</a><br/>
<a href="https://kccncna17.sched.com/mobile/#session:087f2cb57c336670fa23de4bf4f8c1ee">Meeting Room 10AB, Level 3</a><br/>
<a href="http://events.linuxfoundation.org/events/kubecon-and-cloudnativecon-north-america/">Kubecon NA 2017 in Austin, TX</a><br/>
</p>
<br/>
<h5 class='fragment grow'><a href="http://bit.ly/kubecon-dev">http://bit.ly/kubecon-dev</a></h5>
</section>
<section data-background-transition='fade' data-background='black' id='presented-by-ryanj'>
<p>presented by <a href="http://twitter.com/ryanj/">@ryanj</a>, Developer Advocate at Red Hat</p>
<p class='fragment fade-up'><a href="http://twitter.com/ryanj/"><img alt="ryanj" src="http://ryanjarvinen.com/images/ryanj-mestrefungo-com.gif" style="width:50%"/></p>
</section>
</section>
<section id='see-you-at-Kubecon-NA'>
<h3><i><a href="https://kccncna17.sched.com/mobile/#session:087f2cb57c336670fa23de4bf4f8c1ee">See you at KubeCon NA 2017 in Austin, TX!</a></i></h3>
<br/>
<h4 class='fragment grow'><a href="http://bit.ly/kubecon-dev">http://bit.ly/kubecon-dev</a></h4>
</section>
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment