Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save waprin/bcb3400652aea947ab10e9187a8e7aff to your computer and use it in GitHub Desktop.
Save waprin/bcb3400652aea947ab10e9187a8e7aff to your computer and use it in GitHub Desktop.
Kubernetes Command-Line Basics with kubectl http://bit.ly/k8s-kubectl
<section>
<section id="kubernetes-cli-basics-with-kubectl">
<h2>Google Container Engine (GKE) Basics</h2>
<p><a href="http://kubernetes.io/"><img src="https://pbs.twimg.com/profile_images/511909265720614913/21_d3cvM.png" alt="kubernetes" style='width:30%;'></a><br/>with <a href="https://kubernetes.io/docs/user-guide/kubectl/"><code>kubectl</code></a></p>
<h4 class='fragment grow'><a href="http://bit.ly/k8s-kubectl"><code>bit.ly/k8s-kubectl</code></a></h4>
</section>
<section id='presented-by' data-markdown>
presented by
[![CoreOS Logo](http://i.imgur.com/DRm4KEq.png "")](https://coreos.com)
*Continuously ready to face the challenges of a modern world*
Join us in our goal to *Secure the Internet* by chosing solutions that are designed with Continuous Security in mind
</section>
</section>
<section>
<section id='overview'>
<h2>Overview</h2>
<ol>
<li class='fragment'><a href="#/what-is-gke">What Is Container Engine</a>
<li class='fragment'><a href="#//gcp-setup">Google Cloud Project Setup</a>
<li class='fragment'><a href="#/gcloud">gcloud CLI</a>
</ol>
</section>
</section>
<section id='what-is-gke' data-markdown>
# What Is Container Engine (GKE)
- Managed Kubernetes, Google runs Kubernetes master and etcd for you
- Worker nodes are GCE instances in your project
- Besides node cost, GKE is free up to 5 nodes, $.15/hr for over 5 nodes
- Full integration with Google Cloud Platform
- Built in Logging, Monitoring, etc
</section>
<section id='gcp-setup' data-markdown>
# Google Cloud Project Setup
* https://console.cloud.google.com
</section>
<section id='workshop' data-markdown>
# If using workshop account
1. Login with provided username/password
2. Accept Terms and Service
3. Select already created project from drop-down menu
![Select project](http://i.imgur.com/kEjJ1pT.png)
</section>
<section id ='no-workshop'>
<h3>If not using workshop account</h3>
<ul>
<li>Login with your Google account</li>
<li>Accept Terms and Service</li>
<li>Create Billing Account</li>
<ul>
<li>Sign up for $300 12/month free trial</li>
<li>https://console.cloud.google.com/freetrial</li>
<li>Credit card won't be charged at end of free trial</li>
</ul>
<li>Create project
<img src="http://i.imgur.com/IZTz0RG.png" alt="Create project" style="height:100px;"/>
</li>
</ul>
</section>
<section id ='Cloud Shell' data-markdown>
# Cloud Shell
* Free GCE instance setup for your project
* Easy dev environment
* Though still recommend using personal machine if possible
![Cloud Shell](https://cloud.google.com/shell/docs/images/shell_icon.png)
</section>
<section id ='Cloud Shell' >
<h3>Top Left Hamburger menu for global navigation lets you access:</h3>
<ul>
<li>API Manager (enable new APIs)</li>
<li>Billing</li>
<li>Logging and Monitoring</li>
<li>For now, click Container Engine and wait for initialization</li>
</ul>
<img src="http://i.imgur.com/QSI3Tsh.png" alt="Container engine" style="height: 200px;"/>
</section>
<section id='gcloud'>
<h3>gcloud CLI</h3>
<p>Command line tool for interacting with Google Cloud resources</p>
<pre><code contenteditable>curl https://sdk.cloud.google.com | bash</code></pre>
<pre><code contenteditable>exec -l $SHELL # restart shell</code></pre>
<p>Other install instructions at <a href="https://cloud.google.com/sdk/downloads">Cloud SDK Download page</a></p>
<p>Use kubectl for Kubernetes resources, gcloud for Google Cloud resources</p>
</section>
<section id='gcloud commands' >
<p>Configure gcloud</p>
<pre><code contenteditable>gcloud config set project your-project-id</code></pre>
<pre><code contenteditable>gcloud config set compute/zone us-central1-b</code></pre>
<p>List all clusters</p>
<pre><code contenteditable>gcloud container clusters list</code></pre>
<p>Create a new cluster, note that Compute Engine intialization will take a few minutes on new projects.</p>
<pre><code contenteditable>gcloud container clusters create test-cluster</code></pre>
<p>Switch the kubectl context</p>
<pre><code contenteditable>gcloud container clusters get-credentials test-cluster</code></pre>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment