SlideShare a Scribd company logo
1 of 20
Get started with Kubernetes
on GKE
Zach Russell - GDG Cloud Philly
Follow Along!
zachary-russell/kubernetes-on-gke
zachrussell.net/kubernetes-on-gke
Agenda
● Cover the basic Kubernetes nomenclature and concepts
● Create a cluster on GKE
● Deploy a simple app on GKE
● Deploy WordPress on GKE
What is Kubernetes?
● Open source system of managing containerized
applications
● Developed by Google after 15 years of running
containers in production
● Scalable - add as many servers to the cluster
● Portable - run on bare metal, private or public
clouds
Why use Kubernetes
Enterprises
● Run on bare metal for max performance
● Vendor neutral infrastructure
● Multi Cloud
● Variable capacity
● Multi tenancy
● Possibly use spot instances for temp
workloads
SMBs & Startups
● Streamline devops and production
engineering workflows
● Multi tenancy
● Infrastructure can grow with needs
● Modular (only scale what you need to)
● GKE: Committed Use Discounts
Why use GKE
● Installing Kubernetes is complex
● Fully managed by Google SREs
● Auto scale
● Auto upgrade
● Container Optimized OS
● GPUs!
● Integrated Logging/Monitoring (via Stackdriver)
● FREE!
The Basics
Kubernetes Master & Nodes
● Master coordinates the cluster
● Nodes run the processes
● GKE manages the Kubernetes Master with regional replication
Kubernetes Deployment
● Deployment instructs Kubernetes how to create and update instances of
your application.
● Master schedules applications to run on nodes
Kubectl
● CLI for interacting with the Kubernetes API
Pods
● Group of one or more containers with shared resources
○ Network (unique IP)
○ Storage
Service
● Defines how pods communicate (i.e. a microservice)
○ Pod-to-pod communication within a cluster
○ Communication outside the cluster (i.e. a website)
■ ClusterIP
■ Nodeport
■ LoadBalancer
■ ExternalName
Create Cluster
1. Install gCloud SDK and Kubectl ($ gcloud components install kubectl)
2. Start cluster $ gcloud container clusters create [cluster-name]
3. Get auth creds $ gcloud container clusters get-credentials
[CLUSTER_NAME]
4. $ kubectl run hello-server --image gcr.io/google-samples/hello-app:1.0 --
port 8080
5. $ kubectl expose deployment hello-server --type "LoadBalancer"
Run WordPress on GKE
Kubernetes Infrastructure as Code
All Kubectl commands can be stored as code (YAML) and deployed to the
cluster.
1. For volume claims $kubectl apply -f [file_name].yaml
2. For depoyments & services $kubectl create -f [file_name].yaml
Step 1: Create PersistentVolumes and
PersistentVolumeClaims
● PresistentVolumeClaim is a request for storage
● If no volume exists, one is dynamically provisioned
● GKE creates PersistentVolumes backed by persistent disks
$ kubectl apply -f mysql-volumeclaim.yaml
$ kubectl apply -f wordpress-volumeclaim.yaml
Step 2: Deploy MySQL
● Create secret - $ kubectl create secret generic mysql --from-
literal=password=YOUR_PASSWORD
● Deploy Service - $ kubectl create -f mysql.yaml
● Confirm pod is running - $ kubectl get pod -l app=mysql
● Deploy MySQL Service - $ kubectl create -f mysql-service.yaml
● Confirm service is created - $ kubectl get service mysql
Step 3: Deploy WordPress
● Deploy manifest file $ kubectl create -f wordpress.yaml
● Confirm pod is running $ kubectl get pod -l app=wordpress
● Expose WordPress Service $ kubectl create -f wordpress-service.yaml
● Get service external IP $ kubectl get svc -l app=wordpress
● Access your site!
Cleanup
$ kubectl delete service wordpress
$ gcloud compute forwarding-rules list
$ kubectl delete pvc wordpress-volumeclaim
$ kubectl delete pvc mysql-volumeclaim
$ gcloud container clusters delete [cluster_name]
Resources
● Kubernetes.io
● Udacity - Scalable Microservices with Kubernetes (free course by Google)
● Kubernetes the Hard Way by Kacey Hightower
● Minikube
● Kubernetes Slack

More Related Content

What's hot

What's hot (20)

Kubernetes best practices with GKE
Kubernetes best practices with GKEKubernetes best practices with GKE
Kubernetes best practices with GKE
 
Google Cloud platform: GKE with CI/CD using CircleCI and Flux
Google Cloud platform: GKE with CI/CD using CircleCI and FluxGoogle Cloud platform: GKE with CI/CD using CircleCI and Flux
Google Cloud platform: GKE with CI/CD using CircleCI and Flux
 
MicroService architecture_&_Kubernetes
MicroService architecture_&_KubernetesMicroService architecture_&_Kubernetes
MicroService architecture_&_Kubernetes
 
GKE Tip Series - Usage Metering
GKE Tip Series -  Usage MeteringGKE Tip Series -  Usage Metering
GKE Tip Series - Usage Metering
 
Kubernetes best practices.odf
Kubernetes best practices.odfKubernetes best practices.odf
Kubernetes best practices.odf
 
Google cloud infrastructure workshop
Google cloud infrastructure workshopGoogle cloud infrastructure workshop
Google cloud infrastructure workshop
 
Introduction of Kubernetes - Trang Nguyen
Introduction of Kubernetes - Trang NguyenIntroduction of Kubernetes - Trang Nguyen
Introduction of Kubernetes - Trang Nguyen
 
A Primer on Kubernetes and Google Container Engine
A Primer on Kubernetes and Google Container EngineA Primer on Kubernetes and Google Container Engine
A Primer on Kubernetes and Google Container Engine
 
Getting started with Azure Container Service (AKS)
Getting started with Azure Container Service (AKS)Getting started with Azure Container Service (AKS)
Getting started with Azure Container Service (AKS)
 
Swarm migration
Swarm migrationSwarm migration
Swarm migration
 
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...
 
Kubernetes for machine learning
Kubernetes for machine learningKubernetes for machine learning
Kubernetes for machine learning
 
Meteor South Bay Meetup - Kubernetes & Google Container Engine
Meteor South Bay Meetup - Kubernetes & Google Container EngineMeteor South Bay Meetup - Kubernetes & Google Container Engine
Meteor South Bay Meetup - Kubernetes & Google Container Engine
 
Intro to creating kubernetes operators
Intro to creating kubernetes operators Intro to creating kubernetes operators
Intro to creating kubernetes operators
 
PuppetConf 2017: Zero to Kubernetes -Scott Coulton, Puppet
PuppetConf 2017: Zero to Kubernetes -Scott Coulton, PuppetPuppetConf 2017: Zero to Kubernetes -Scott Coulton, Puppet
PuppetConf 2017: Zero to Kubernetes -Scott Coulton, Puppet
 
From development to production: Deploying Java and Scala apps to kubernetes
From development to production: Deploying Java and Scala apps to kubernetesFrom development to production: Deploying Java and Scala apps to kubernetes
From development to production: Deploying Java and Scala apps to kubernetes
 
Stateful applications on kubernetes
Stateful applications on kubernetesStateful applications on kubernetes
Stateful applications on kubernetes
 
CD, docker and kubernetes
CD, docker and  kubernetesCD, docker and  kubernetes
CD, docker and kubernetes
 
The evolving container landscape
The evolving container landscapeThe evolving container landscape
The evolving container landscape
 
Kubernetes
KubernetesKubernetes
Kubernetes
 

Similar to Get started with Kubernetes on GKE

kubeadm Cluster Creation Internals_ From Self-Hosting to Upgradability and HA...
kubeadm Cluster Creation Internals_ From Self-Hosting to Upgradability and HA...kubeadm Cluster Creation Internals_ From Self-Hosting to Upgradability and HA...
kubeadm Cluster Creation Internals_ From Self-Hosting to Upgradability and HA...
ssuser92b4be
 

Similar to Get started with Kubernetes on GKE (20)

Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Deploying WSO2 API Manager in Production-Grade Kubernetes
Deploying WSO2 API Manager in Production-Grade KubernetesDeploying WSO2 API Manager in Production-Grade Kubernetes
Deploying WSO2 API Manager in Production-Grade Kubernetes
 
My kubernetes toolkit
My kubernetes toolkitMy kubernetes toolkit
My kubernetes toolkit
 
Kubernetes & Google Container Engine @ mabl
Kubernetes & Google Container Engine @ mablKubernetes & Google Container Engine @ mabl
Kubernetes & Google Container Engine @ mabl
 
Kubernetes - Using Persistent Disks with WordPress and MySQL
Kubernetes - Using Persistent Disks with WordPress and MySQLKubernetes - Using Persistent Disks with WordPress and MySQL
Kubernetes - Using Persistent Disks with WordPress and MySQL
 
kubeadm Cluster Creation Internals_ From Self-Hosting to Upgradability and HA...
kubeadm Cluster Creation Internals_ From Self-Hosting to Upgradability and HA...kubeadm Cluster Creation Internals_ From Self-Hosting to Upgradability and HA...
kubeadm Cluster Creation Internals_ From Self-Hosting to Upgradability and HA...
 
Gitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a proGitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a pro
 
Pro2516 10 things about oracle and k8s.pptx-final
Pro2516   10 things about oracle and k8s.pptx-finalPro2516   10 things about oracle and k8s.pptx-final
Pro2516 10 things about oracle and k8s.pptx-final
 
Learn kubernetes in 90 minutes
Learn kubernetes in 90 minutesLearn kubernetes in 90 minutes
Learn kubernetes in 90 minutes
 
Hardening automation with Kubespray by Alessio Greggi
Hardening automation with Kubespray by Alessio GreggiHardening automation with Kubespray by Alessio Greggi
Hardening automation with Kubespray by Alessio Greggi
 
Top 3 reasons why you should run your Enterprise workloads on GKE
Top 3 reasons why you should run your Enterprise workloads on GKETop 3 reasons why you should run your Enterprise workloads on GKE
Top 3 reasons why you should run your Enterprise workloads on GKE
 
Kubeflow on google kubernetes engine
Kubeflow on google kubernetes engineKubeflow on google kubernetes engine
Kubeflow on google kubernetes engine
 
Mattia Gandolfi - Improving utilization and portability with Containers and C...
Mattia Gandolfi - Improving utilization and portability with Containers and C...Mattia Gandolfi - Improving utilization and portability with Containers and C...
Mattia Gandolfi - Improving utilization and portability with Containers and C...
 
Scalable Spark deployment using Kubernetes
Scalable Spark deployment using KubernetesScalable Spark deployment using Kubernetes
Scalable Spark deployment using Kubernetes
 
Session 4 GCCP.pptx
Session 4 GCCP.pptxSession 4 GCCP.pptx
Session 4 GCCP.pptx
 
Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17
 
Bdc from bare metal to k8s
Bdc   from bare metal to k8sBdc   from bare metal to k8s
Bdc from bare metal to k8s
 
Kubernetes - Security Journey
Kubernetes - Security JourneyKubernetes - Security Journey
Kubernetes - Security Journey
 
Flowable on Kubenetes
Flowable on KubenetesFlowable on Kubenetes
Flowable on Kubenetes
 
K8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals TrainingK8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals Training
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Get started with Kubernetes on GKE

  • 1. Get started with Kubernetes on GKE Zach Russell - GDG Cloud Philly
  • 3. Agenda ● Cover the basic Kubernetes nomenclature and concepts ● Create a cluster on GKE ● Deploy a simple app on GKE ● Deploy WordPress on GKE
  • 4. What is Kubernetes? ● Open source system of managing containerized applications ● Developed by Google after 15 years of running containers in production ● Scalable - add as many servers to the cluster ● Portable - run on bare metal, private or public clouds
  • 5. Why use Kubernetes Enterprises ● Run on bare metal for max performance ● Vendor neutral infrastructure ● Multi Cloud ● Variable capacity ● Multi tenancy ● Possibly use spot instances for temp workloads SMBs & Startups ● Streamline devops and production engineering workflows ● Multi tenancy ● Infrastructure can grow with needs ● Modular (only scale what you need to) ● GKE: Committed Use Discounts
  • 6. Why use GKE ● Installing Kubernetes is complex ● Fully managed by Google SREs ● Auto scale ● Auto upgrade ● Container Optimized OS ● GPUs! ● Integrated Logging/Monitoring (via Stackdriver) ● FREE!
  • 8. Kubernetes Master & Nodes ● Master coordinates the cluster ● Nodes run the processes ● GKE manages the Kubernetes Master with regional replication
  • 9. Kubernetes Deployment ● Deployment instructs Kubernetes how to create and update instances of your application. ● Master schedules applications to run on nodes
  • 10. Kubectl ● CLI for interacting with the Kubernetes API
  • 11. Pods ● Group of one or more containers with shared resources ○ Network (unique IP) ○ Storage
  • 12. Service ● Defines how pods communicate (i.e. a microservice) ○ Pod-to-pod communication within a cluster ○ Communication outside the cluster (i.e. a website) ■ ClusterIP ■ Nodeport ■ LoadBalancer ■ ExternalName
  • 13. Create Cluster 1. Install gCloud SDK and Kubectl ($ gcloud components install kubectl) 2. Start cluster $ gcloud container clusters create [cluster-name] 3. Get auth creds $ gcloud container clusters get-credentials [CLUSTER_NAME] 4. $ kubectl run hello-server --image gcr.io/google-samples/hello-app:1.0 -- port 8080 5. $ kubectl expose deployment hello-server --type "LoadBalancer"
  • 15. Kubernetes Infrastructure as Code All Kubectl commands can be stored as code (YAML) and deployed to the cluster. 1. For volume claims $kubectl apply -f [file_name].yaml 2. For depoyments & services $kubectl create -f [file_name].yaml
  • 16. Step 1: Create PersistentVolumes and PersistentVolumeClaims ● PresistentVolumeClaim is a request for storage ● If no volume exists, one is dynamically provisioned ● GKE creates PersistentVolumes backed by persistent disks $ kubectl apply -f mysql-volumeclaim.yaml $ kubectl apply -f wordpress-volumeclaim.yaml
  • 17. Step 2: Deploy MySQL ● Create secret - $ kubectl create secret generic mysql --from- literal=password=YOUR_PASSWORD ● Deploy Service - $ kubectl create -f mysql.yaml ● Confirm pod is running - $ kubectl get pod -l app=mysql ● Deploy MySQL Service - $ kubectl create -f mysql-service.yaml ● Confirm service is created - $ kubectl get service mysql
  • 18. Step 3: Deploy WordPress ● Deploy manifest file $ kubectl create -f wordpress.yaml ● Confirm pod is running $ kubectl get pod -l app=wordpress ● Expose WordPress Service $ kubectl create -f wordpress-service.yaml ● Get service external IP $ kubectl get svc -l app=wordpress ● Access your site!
  • 19. Cleanup $ kubectl delete service wordpress $ gcloud compute forwarding-rules list $ kubectl delete pvc wordpress-volumeclaim $ kubectl delete pvc mysql-volumeclaim $ gcloud container clusters delete [cluster_name]
  • 20. Resources ● Kubernetes.io ● Udacity - Scalable Microservices with Kubernetes (free course by Google) ● Kubernetes the Hard Way by Kacey Hightower ● Minikube ● Kubernetes Slack