Last active
October 17, 2018 23:01
-
-
Save ryanj/c688c87e59c3bb5a419c2520d6cc6de8 to your computer and use it in GitHub Desktop.
Hands-on with OpenShift (featuring Minishift) http://bit.ly/k8s-openshift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section data-transition='concave'> | |
<section id='Hands-on-OpenShift-using-minishift'> | |
<p><img style='border:none;background:none;width:' src="http://hexb.in/vector/openshift.svg" /></p> | |
<h2>Hands-On OpenShift</h2> | |
<h3>with <a href="https://github.com/minishift/minishift"><code>minishift</code></a></h3> | |
<br/> | |
<h4 class='fragment grow'><a href="http://bit.ly/k8s-openshift"><code>bit.ly/k8s-openshift</code></a></h4> | |
</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 <a href='http://redhat.com' style='color:red;'>Red Hat</a></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> | |
<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 <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…</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 & | |
# Collaborate | |
</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> | |
</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 | |
<!-- TODO: include node10 installation notes --> | |
</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