Forked from waprin/kubernetes-cli-basics-with-kubectl.html
Last active
March 9, 2021 21:10
-
-
Save ryanj/3c159559587f44389536dc0cea5f11d2 to your computer and use it in GitHub Desktop.
Local access to GKE with gcloud - http://bit.ly/k8s-gcloud
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> | |
<section id="local-access-to-GKE-with-gcloud"> | |
<a href="https://cloud.google.com/sdk/downloads"><img src="https://cdn.rawgit.com/ryanj/bb3946992e3ea9521bf8dc21b70f4145/raw/e00572ca6f5c5e48d33bc11e51c1bd42c777e80d/gcp-logo.svg" alt="kubernetes" style='width:33%;'></a> | |
<h2>Local Access to GKE</h2> | |
<h3>with <code>gcloud</code></h3> | |
<br/> | |
<h4 class='fragment grow'><a href="http://bit.ly/k8s-gcloud"><code>bit.ly/k8s-gcloud</code></a></h4> | |
</section> | |
<section 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 id='gke-overview'> | |
<h2>GKE Overview</h2> | |
<ol> | |
<li class='fragment'><a href="#/what-is-gke">What Is GKE?</a></li> | |
<li class='fragment'><a href="#/gke-initialization">Google Cloud Project Setup</a></li> | |
<li class='fragment'><a href="#/gcloud-install"><code>gcloud</code> installation</a></li> | |
<li class='fragment'><a href="#/gcloud-configure"><code>gcloud</code> configuration</a></li> | |
<li class='fragment'><a href="#/gcloud-setup-verification">Configure <code>kubectl</code> to connect to your new GKE-hosted Kubernetes environment</a></li> | |
</ol> | |
</section> | |
<section id='what-is-gke'> | |
<h2>Q: What Is Container Engine (GKE)</h2> | |
<h3 class='fragment fade-left'><i>A: Managed Kubernetes from Google</i></h3> | |
<ul> | |
<li class='fragment fade-up'>Google runs the Kubernetes master and etcd instances</li> | |
<li class='fragment fade-up'>Infrastructure is provided by Google Cloud Platform | |
<ul class='fragment fade-up'> | |
<li>Built in Logging, Monitoring, etc</li> | |
<li>Worker nodes are GCE instances in your project</li> | |
</ul> | |
</li> | |
</ul> | |
</section> | |
<section id='gke-pricing' data-markdown> | |
### GKE Pricing | |
* First 5 nodes are free, $.15/hr over 5 nodes | |
* Worker nodes are priced separately (through GCE) | |
</section> | |
<section id='project-access-for-workshop-attendees' data-markdown> | |
## GCP Project Access | |
Workshop Attendees: | |
1. Log in to GCP using the provided username & password at: | |
[console.cloud.google.com](https://console.cloud.google.com) | |
2. Accept the Terms of Service | |
3. Select the workshop project from drop-down menu | |
![Select project](http://i.imgur.com/kEjJ1pT.png) | |
</section> | |
<section id='remote-attendees'> | |
<h3>Remote Workshop Participants</h3> | |
<ol> | |
<li>Login to GCP using your Google account at: <br/><a href="https://console.cloud.google.com">console.cloud.google.com</a></li> | |
<li>Accept the Terms of Service</li> | |
<li>Create a Billing Account | |
<ul> | |
<li>Sign up for the $300 12/month free trial</li> | |
<li>https://console.cloud.google.com/freetrial</li> | |
<li>Your credit card won't be charged at end of free trial</li> | |
</ul> | |
</li> | |
<li>Create a new project for this workshop</li> | |
</ol> | |
<img class='fragment fade-down' src="http://i.imgur.com/IZTz0RG.png" alt="Create project" style="width:70%;"/> | |
</section> | |
<section id ='cloud-shell' data-markdown> | |
## Cloud Shell | |
1. A free GCE instance for your project | |
2. A cloud-based CLI environment, available on-demand | |
3. An excellent alternative for folks who lack a local environment to work in | |
![Cloud Shell](https://cloud.google.com/shell/docs/images/shell_icon.png) | |
</section> | |
<section id ='gke-initialization' > | |
<h3>The top left menu icon provides access to:</h3> | |
<div style="float:left;width:60%;"> | |
<ol> | |
<li>API Manager (enable new APIs)</li> | |
<li>Billing</li> | |
<li>Logging and Monitoring</li> | |
<li>Compute Engine</li> | |
<li>Container Engine</li> | |
</ol> | |
<p>For now, click <b>Container Engine</b> and wait for initialization…</p> | |
</div> | |
<div class='fragment fade-left' style='float:right;width:30%'> | |
<img src="http://i.imgur.com/QSI3Tsh.png" style="width:100%;"> | |
</div> | |
</section> | |
<section id='gcloud-install'> | |
<h3>Installing the <code>gcloud</code> CLI</h3> | |
<p>Command line tool for interacting with GCP 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 are available on the <a href="https://cloud.google.com/sdk/downloads">Google Cloud SDK Download page</a></p> | |
<p>Use <a href="http://gist-reveal.it/bit.ly/k8s-minikube#/kubectl"><code>kubectl</code></a> to manage Kubernetes resources, and <code>gcloud</code> to manage GCP resources</p> | |
</section> | |
<section id='gcloud-configuration'> | |
<h3>Configuring glcoud</h3> | |
<p>Configure gcloud to use the correct project and availability zone</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. Compute Engine will require a few minutes to initialize new projects</p> | |
<pre><code contenteditable>gcloud container clusters create test-cluster</code></pre> | |
</section> | |
<section id='gcloud-setup-verification'> | |
<h3>Verify GKE Accessibility</h3> | |
<p>To verify that both GKE and <code>gcloud</code> have been configured correctly, switch your <code>kubectl</code> context to GKE:</p> | |
<pre><code contenteditable>gcloud container clusters get-credentials test-cluster</code></pre> | |
<p>Then, list your GCE-provided Kubernetes worker nodes:</p> | |
<pre><code contenteditable>kubectl get nodes</code></pre> | |
<p>If <code>kubectl</code> isn't available, you may need to <a href="http://gist-reveal.it/bit.ly/k8s-minikube#/overview">configure your machine for local development with the k8s-minikube workshop</a>.</p> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment