Skip to content

Instantly share code, notes, and snippets.

@ryanj
Last active January 22, 2019 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanj/8a3f60eb689fadcd26358e3368b80cfc to your computer and use it in GitHub Desktop.
Save ryanj/8a3f60eb689fadcd26358e3368b80cfc to your computer and use it in GitHub Desktop.
Red Hat Community Central: Kubernetes from Dev to Production - http://bit.ly/rhcommunity
<section data-transition='concave'>
<section id='Kubernetes-from-Dev-to-Prod-with-Red-Hat' data-transition="zoom" data-background="https://gist.github.com/ryanj/6228809ae7b11191debc8028bc1a9f1e/raw/2e0672fc45b385e074b635dea0dd5578f171bb47/s1.png" data-background-color="black" data-background-size="cover" data-background-position="top">
<!-- <p class='fragment grow' style='color:white;padding-top:50%;'><a style='color:white;' href="http://bit.ly/SAPdkomRH">http://bit.ly/SAPdkomRH</a></p> -->
</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</p>
<p><a href="http://twitter.com/ryanj/"><img alt="ryanj" src="http://ryanjarvinen.com/images/ryanj-mestrefungo-com.gif" style="width:50%" /></p>
</section>
<section id='brought-to-you-by' data-background='black' data-background-color="black">
<p style="color:white;">brought to you by</p>
<p style="color:white;"><a href="https://redhat.com"><img alt="Red Hat logo" src="https://i.imgur.com/ArZFG3e.png" /></a></p>
</section>
</section>
<section data-background-transition='fade' data-background='black' id='who'>
<h2 style='color:white;'>Who?</h2>
</section>
<section data-background='black' id="what">
<p style='color:white;'>what do we do?</p>
<br/>
<p style='color:white;' class='fragment zoom'>The best <b>X</b> in <b>Y</b> given <b>Z</b></p>
</section>
</section>
<section data-background='black' id="the-best">
<p style='color:white;' class='fragment zoom'>maximize effective use of open source technology</p>
</section>
<section id='s2' data-transition="zoom" data-background="https://gist.github.com/ryanj/6228809ae7b11191debc8028bc1a9f1e/raw/2e0672fc45b385e074b635dea0dd5578f171bb47/s2.png" data-background-color="black" data-background-size="cover" data-background-position="top">
&nbsp;
</section>
<section data-background='black' id="how">
<p style='color:white;'>how?</p>
<br/>
<p style='color:white;' class='fragment zoom'><i>distributions</i></p>
</section>
<section data-background='black' id="then-now">
<p style='color:white;'>then</p>
<br/>
<p style='color:white;' class='fragment zoom'><i>NOW</i></p>
</section>
<section id='whats-in-a-distro' data-transition="zoom" data-background="none" data-background-color="black" data-background-size="cover" data-background-position="top">
bringing you the best in Enterprise-grade open source
<p class='transition fade-up'><a href="http://okd.io"><img src='https://gist.github.com/ryanj/6228809ae7b11191debc8028bc1a9f1e/raw/45a684ed9839aac60ad8ed75dbd16775e14e3f19/okd-inputs-outputs.png' /></a></p>
</section>
<section id="consistency" data-background-color="black" data-markdown>
## Goal: Consistency
Kubernetes from Development to Production
</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
* includes, extends, is a distribution of: Kubernetes
* adds: mult-tenanant security, developer workflows, logging, metrics, platform automation features
</section>
<section id="minishift" data-background-color="black" data-markdown>
### the easy part is
`minishift start`
</section>
<section data-background-color="black" id="works-for-me" data-markdown>
### QA response
> *"works fine on my kubernetes cluster"*
</section>
<!--
<section id='s5' data-transition="zoom" data-background="https://gist.github.com/ryanj/6228809ae7b11191debc8028bc1a9f1e/raw/2e0672fc45b385e074b635dea0dd5578f171bb47/s5.png" data-background-color="black" data-background-size="cover" data-background-position="top">
&nbsp;
</section>
<section id='s3' data-transition="zoom" data-background="https://gist.github.com/ryanj/6228809ae7b11191debc8028bc1a9f1e/raw/2e0672fc45b385e074b635dea0dd5578f171bb47/s3.png" data-background-color="black" data-background-size="cover" data-background-position="top">
&nbsp;
</section>
<section id='s6' data-background="https://gist.github.com/ryanj/6228809ae7b11191debc8028bc1a9f1e/raw/2e0672fc45b385e074b635dea0dd5578f171bb47/s6.png" data-background-color="black" data-background-size="cover" data-background-position="top">
&nbsp;
</section>
-->
<section id='s7' data-background="https://gist.github.com/ryanj/8a3f60eb689fadcd26358e3368b80cfc/raw/31f6b31e8d876f5a78494fd7aecaef297a7a8f42/available-on-any-infra.png" data-background-color="black" data-background-size="cover" data-background-position="top">
&nbsp;
</section>
<section id='success' data-markdown>
### Replicate Your Success
</section>
<section id='service-catalog-on-openshift'>
<h2>Service Catalog & Brokers</h2>
<p>Expose and provision services</p>
<p><img style='width:100%;' src='https://github.com/ryanj/redisconf-2018/raw/master/static/catalog-options.png' alt='pluggable-broker-options' /></p>
<p><a href="https://www.openservicebrokerapi.org/">www.openservicebrokerapi.org</a></p>
</section>
<section id='expansion' data-markdown>
## Extending Kubernetes
</section>
<section id='the-future' data-markdown>
## Future Focus Areas
* Rapid development with **Red Hat CodeReady Workspaces** featuring **Eclipse Che**
* Extending Kubernetes:
* with the **OpenServiceBrokerAPI**
* with the **Operator Framework**
* New Workloads:
* Service Meshes with **Istio**
* VMs via **KubeVirt**
* Serverless / Functional with **Knative**, **openWhisk**
* Operator-based workloads
* **OpenShift v4** Developer Preview
</section>
<section data-background-color="black" id='follow-up' data-markdown>
## Try it
* [OpenShift learning portal](http://learn.openshift.com)
* [learn.openshift.com](http://learn.openshift.com)
* [Red Hat CodeReady workspaces](https://developers.redhat.com/blog/2018/12/11/codeready-workspaces-openshift/)
* [red.ht/che-pet-clinic](http://red.ht/che-pet-clinic)
* [OpenShift v4 Developer Preview](http://try.openshift.com)
* [try.openshift.com](http://try.openshift.com)
</section>
<section data-background-color='black' id='q-and-a'>
<h1 style='color:white;'>Q&amp;A</h1>
</section>
<section id='thank-you' data-markdown>
# Thank You!
Ryan Jarvinen @ryanj
http://bit.ly/rhcommunity
</section>
<!--
<section data-transition='concave' id='minishift-start'>
<h3 id="minishift-start">minishift start</h3>
<p>To follow along with these examples, you'll need to run minishift locally</p>
<p>You should be able to start it with:</p>
<pre><code contenteditable>minishift start</code></pre>
<p>If <code>minishift</code> fails to start, check the <a href="https://github.com/minishift/minishift/">official README</a>, or try <a href="http://bit.ly/k8s-minishift-setup">bit.ly/k8s-minishift-setup</a></p>
</section>
<section data-transition='zoom-in convex-out' id='ready'>
<h1><i>Ready?</i></h1>
<br/>
<div class='fragment fade-up'>
<p>Verify that your local OpenShift environment is ready by running:<br/>
<pre><code contenteditable>oc version</code></pre>
<p>The output should include your <code>oc</code> version info, and the release version of the kubernetes API server (when available)</p>
<p class='fragment'>If running <code>oc version</code> results in an error, try revisting the setup steps at <a href="http://bit.ly/k8s-minishift-setup">bit.ly/k8s-minishift-setup</a>, or consult the official minishift&nbsp;<a href="http://github.com/minishift/minishift">README</a> on GitHub</p>
</div>
</section>
<section data-background-transition="zoom">
<h1><i>Let's Go!</i></h1>
</section>
<section data-transition="convex" id='hands-on-with-openshift'>
<h3>Hands-On with OpenShift</h3>
<ol>
<li class='fragment'><a href="#/build">Build</a></li>
<li class='fragment'><a href="#/deploy">Deploy</a></li>
<li class='fragment'><a href="#/iterate">Iterate</a></li>
<li class='fragment'><a href="#/collaborate">Collaborate</a></li>
<li class='fragment'><a href="#/extend">Extend</a></li>
</ol>
</section>
<section>
<section id='build'>
<h1>Build</h1>
<p class='fragment'>Build and deploy container images</p>
</section>
<section id='openshift-web-console'>
<h3>Introducing&hellip;</h3>
<h2>The OpenShift Web Console</h2>
<br/>
<div class='fragment'>
<p>Access the dashboard by running:</p>
<pre><code contenteditable>minishift dashboard</code></pre>
</div>
</section>
<section id='add-to-project'>
<h2>Web Workflow: Create</h2>
<p>For this example, we will deploy a fork of the <code>ryanj/http-base</code> repo by clicking on "<b>Add to Project</b>" in the web console</p>
<p>Example repo source: <a href="http://github.com/ryanj/http-base/">http://github.com/ryanj/http-base</a></p>
<ol>
<li class='fragment'>Fork the <code>ryanj/http-base</code> repo on GitHub. This will allow you to configure your own GitHub webhooks in the upcoming <a href='#/deploy'>Deploy</a> section</li>
<li class='fragment'>Return to the web console and click on "Add to Project"</li>
<li class='fragment'>Next, select a <code>nodejs</code> base image, and name your webservice "<code>http-base</code>". Then enter the github url for <b>your</b> fork</li>
<li class='fragment'>Review the options, then press the "<b>Create</b>" button when you're ready to proceed</li>
</ol>
</section>
<section id='get-pods'>
<h2>Container Status</h2>
<p class='fragment'>The web console uses a socket stream to report status changes as they occur throughout the cluster</p>
<div class='fragment'>
<p>After the build task has completed, find the <code>NAME</code> of the pod where your image has been deployed:</p>
<pre><code contenteditable>oc get pods</code></pre>
</div>
<div class='fragment'>
<p>As with the core APIs, the CLI output is consistently formatted, following established patterns:</p>
<pre><code contenteditable>kubectl get pods</code></pre>
</div>
</section>
<section id='source-to-image-demo'>
<h2>Source</h2>
<p>to</p>
<h1>Image</h1>
<p class='fragment'>Combines source repos and operationally-maintained builder images to produce application images</p>
<p class='fragment'>Available as a standalone project, for use with Jenkins or other external builder processes: <a href="https://github.com/openshift/source-to-image">github.com/openshift/source-to-image</a></p>
</section>
</section>
<section data-transition="linear">
<section id="deploy">
<h1>Deploy</h1>
<p class='fragment'><code>git push</code> to deploy</p>
</section>
<section id='clone'>
<h3>Send in the Clones</h3>
<p>Clone a local copy of <b>your repo fork</b> by adding <b>your own github username</b> to the following command:</p>
<pre><code>git clone http://github.com/YOUR_GH_USERNAME/http-base
cd http-base</code></pre>
</section>
<section id='webhooks'>
<h2>WebHook Build Automation</h2>
<p>Set up a commit WebHook to automate image production</p>
<p class='fragment'>Explore the <code>Build</code> resources using the web console. Look for the GitHub Webhook settings. Copy the webhook url, and paste it into your repo's Webhook settings on GitHub</p>
<p class='fragment'>If you're running OpenShift locally in a VM, try using <a href="http://www.ultrahook.com/">ultrahook</a> to proxy webhook events to your laptop</p>
</section>
<section id='git-push-to-build-and-ship'>
<h2>ReBuild on Push</h2>
<p class='fragment'>After configuring the webhook for your repo, add a small commit locally, then <code>git push</code> to deploy</p>
<pre class='fragment'><code contenteditable>git push</code></pre>
<p class='fragment'>Or, use GitHub's web-based editor to make a minor change</p>
<div class='fragment'><p>If you don't have a working webhook to automate the build process, it can also be started manually:</p>
<pre><code contenteditable>oc start-build http-base</code></pre>
</div>
</section>
</section>
<section data-transition="linear">
<section id="iterate">
<h1>Iterate</h1>
<p class='fragment'>Iterate using a fully containerized toolchain</p>
</section>
<section id='oc-rsync'>
<h3>Live Development</h3>
<p class='fragment'>Make a minor edit to your local repo's <code>index.html</code> file,</p>
<div class='fragment'>
<p>then test your changes <i>before you commit</i> by synching content into your hosted container:</p>
<pre><code contenteditable>export PODNAME=$(oc get pods -l app=http-base | tail -n 1 | cut -f1 -d' ')
oc rsync -w --exclude='.git,node_modules' . $PODNAME:</code></pre>
</div>
</section>
<section id="terminal" data-markdown>
## Terminal Access
* Available in the Web Console
* And on the CLI, with:
oc exec -it $PODNAME -- bash
curl http-base
</section>
<section id='keys-and-configs' data-markdown>
## Configuration
[Environment Variables](https://docs.openshift.org/latest/dev_guide/environment_variables.html) are one way to add configuration settings to your images:
oc env dc/http-base KEY=VALUE
ConfigMaps and Secrets are also useful configuration abstractions
</section>
<section id='logging' data-markdown>
## Logs
Centralized logging and metrics
</section>
<section id="deployment-strategies">
<h2>Deployment Strategies</h2>
<p class="fragment">Get more control of your container rollout and update processes by selecting appropriate <a href="https://docs.openshift.org/latest/dev_guide/deployments.html#strategies">deployment strategies</a> for your fleet of managed containers</p>
</section>
</section>
<section>
<section id='collaborate' data-markdown>
# Share &amp;
# Collaborate
</section>
<section id='service-catalog-on-openshift'>
<h2>Service Catalog &amp; Brokers</h2>
<p>Expose and provision services</p>
<p><img style='width:100%;' src='https://github.com/ryanj/redisconf-2018/raw/master/static/catalog-options.png' alt='pluggable-broker-options' /></p>
<p><a href='https://www.openservicebrokerapi.org/'>www.openservicebrokerapi.org</a>
</section>
<section id='service-catalog' data-markdown>
### Everyone's Service Catalog
> "The Open Service Broker API project allows developers, ISVs, and SaaS vendors a single, simple, and elegant way to deliver services to applications running within cloud native platforms"
Works with: [Kubernetes](https://github.com/kubernetes-incubator/service-catalog), [OpenShift](https://docs.openshift.com/container-platform/3.6/architecture/service_catalog/template_service_broker.html), [Cloud Foundry](https://github.com/spring-cloud/spring-cloud-open-service-broker)
</section>
<section data-markdown>
### Available Service Brokers
* [Template Broker](#)
* [Helm Chart Broker](#)
* [AWS Broker](https://aws.amazon.com/blogs/opensource/aws-service-operator-kubernetes-available/)
* [DIY Broker example](#)
</section>
<section id='installers'>
<h2>Templates as Installers</h2>
<div class='fragment'>
<p>Install a template into the current project, making it easier to reuse:</p>
<pre><code contenteditable>oc create -f template.json</code></pre>
</div>
<div class='fragment'>
<p>Create an application from an installed template, from a file, or from a url:</p>
<pre><code contenteditable>oc new-app -f template.json</code></pre>
</div>
</section>
<section id='composable-app-example'>
<h2>Multi-Service App Example</h2>
<p>Nodejs and MongoDB multi-service application example:</p>
<pre><code contenteditable>oc create -f https://raw.githubusercontent.com/openshift-roadshow/nationalparks-js/master/nationalparks-js.json</code></pre>
<p><a href="https://raw.githubusercontent.com/openshift-roadshow/nationalparks-js/master/nationalparks-js.json">github.com/ryanj/nationalparks-js</a></p>
<p>Review and install the above template content using <code>oc create</code>, then try launching it via the web-based Service Catalog.</p>
<div class="fragment">
<p>When you're done, list all available API resources to review the contents of your project namespace:</p>
<pre><code contenteditable>oc get all</code></pre>
</div>
</section>
</section>
<section>
<section id='extend'>
<h1>Advanced Extensibility</h1>
</section>
<section id='standardize' data-markdown>
### Standardize your environments with custom base images
https://docs.okd.io/latest/using_images/s2i_images/nodejs.html
https://github.com/bucharest-gold/centos7-s2i-nodejs
</section>
<section id='Operators'>
<h1>"Operators"</h1>
<p>Operators = <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/">Custom Resources</a> + <a href="https://github.com/kubernetes/sample-controller">Custom Controllers</a></p>
<p class='fragment'><a href="https://coreos.com/operators/">coreos.com/operators</a></p>
<p class='fragment'><a href=" https://github.com/operator-framework/awesome-operators">github.com/operator-framework/awesome-operators</a></p>
</section>
</section>
<section data-transition='concave' id='next-steps'>
<h3>Congratulations on completing:</h3>
<p>
<a href="http://bit.ly/k8s-openshift">
<b>OpenShift Basics (with <code>minishift</code>)</b>
<h5 class='fragment grow'><code>bit.ly/k8s-openshift</code></h5>
</a>
</p>
<br/>
<h4><i>Next Steps</i></h4>
<p>Try the <a href="http://learn.openshift.com">OpenShift learning portal</a> at:</p>
<p><a href="http://learn.openshift.com">learn.openshift.com</a></p>
<p>Or, continue learning with other <a href="http://bit.ly/k8s-workshops"><code>k8s-workshops</code></a>:</p>
<ol>
<li><a href="http://bit.ly/realtime-odo"><b>Realtime Front-End Web Development with odo</b><br/>bit.ly/realtime-odo</a></li>
<li><a href="http://bit.ly/operatorpattern"><b>Extending Kubernetes with the Operator Pattern</b><br/><span style='font-size:smaller;'>bit.ly/operatorpattern</span></a></li>
</ol>
</section>
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment