Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GDG Cloud Jakarta - GKE 101

GDG Cloud Jakarta - GKE 101

Ananda Dwi Ae

March 25, 2021
Tweet

More Decks by Ananda Dwi Ae

Other Decks in Technology

Transcript

  1. Agenda 1. Container and Orchestration 2. Kubernetes Concept & GKE

    Concept 3. Understanding Clusters and Nodes 4. Pods, Deployments and ReplicaSets 5. Services and Network Ingress 6. Deployment Patterns 7. Stateful Applications and Storage 8. Secrets and Configurations
  2. Monolithic applications were created from small applications and then built

    up to create a tiered architecture that separated the frontend from the backend, and the backend from the data sources. Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of services that are: • Highly maintainable and testable • Loosely coupled • Independently deployable • Organized around business capabilities • Owned by a small team Reference: https://microservices.io/ Monolithic and Microservices
  3. A container image is a lightweight, stand-alone, executable package of

    a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings. Containerization based on virtualization allows any application bundled in a container which can be run without the hassles of any dependency like libraries. They are a kind of isolated partition inside a single operating system. Container orchestration is a fundamental enabler of digital transformation initiatives. It allows developers and IT organizations to better manage application life cycles. For example: Docker Swarm, Kubernetes, OpenShift, Mesos and Marathon Container and Orchestration
  4. • Project from Google as an open-source container orchestration platform.

    • Built from the experiences of developing and running Google’s Borg and Omega. • Designed from the ground-up as a loosely coupled collection of components centered around deploying, maintaining, and scaling workloads. What is Kubernetes?
  5. • Auto Scaling Easily scale applications up and down manually

    or based CPU utilization. • Bin Packing Optimize your compute usage by bin packing containers. • Rollout Automation Progressively roll out changes while automatically monitoring applications health. • Self Healing Containers that fail health checks are automatically replaced. • Service Discovery Simple DNS and load balancing provided out of the box. • Storage Automation Easily manage persistent cloud disks or mount other storage providers. Why Kubernetes?
  6. • A Kubernetes object All configuration in Kubernetes happens through

    creating objects and object states. • A logical application-centric unit Can comprise one or more containers that share a file system and a network IP address. • The smallest thing you can deploy You can’t deploy containers unless they’re inside a Pod. What is a Pod?
  7. • Declare Define the pod in a YAML configuration file.

    • Apply Apply the configuration by sending it to the master API. • State The state of the cluster is updated to reflect the new declaration. Creating Pods
  8. • Represent a set of multiple, identical Pods with no

    unique identities. • It runs multiple replicas of your application and automatically replaces any instances that fail or become unresponsive. Deployments
  9. 1. Exposes Pods to the network A set of Pods

    will be given a single fixed IP address. Traffic is round-robined between Pods in the service. 2. Chooses Pods with Selectors Selectors match groups of key-value pairs from Pod metadata. 3. Exposes Pods in different ways Choose from ClusterIP, NodePort, or LoadBalancer. What Does a Service Do?
  10. Service Selector Patterns nginx Pod app=nginx env=prod nginx Pod app=nginx

    env=prod nginx Pod app=nginx env=staging nginx Pod app=nginx env=staging “Web” Service app=nginx
  11. Service Selector Patterns nginx Pod app=nginx env=prod nginx Pod app=nginx

    env=prod nginx Pod app=nginx env=staging nginx Pod app=nginx env=staging Web-Staging Service app=nginx Web-prod Service app=nginx env=prod env=staging web-staging.default.svc.cluster.local
  12. Canary Deployments ReplicaSet app:v2 Service Deployment ReplicaSet app:v1 app:v1 app:v1

    app=frontend env=prod Deployment app=frontend env=canary app=frontend
  13. Blue/Green Deployments Service Blue Deployment Green Deployment ReplicaSet app:v1 app:v1

    app:v1 app=frontend version=1 app=frontend, version=1 ReplicaSet app:v2 app:v2 app:v2 app=frontend version=2
  14. Blue/Green Deployments Service Blue Deployment Green Deployment ReplicaSet app:v1 app:v1

    app:v1 app=frontend version=1 app=frontend, version=2 ReplicaSet app:v2 app:v2 app:v2 app=frontend version=2
  15. Blue/Green Deployments Service Blue Deployment Green Deployment ReplicaSet app:v3 app:v3

    app:v3 app=frontend version=3 app=frontend, version=3 ReplicaSet app:v2 app:v2 app:v2 app=frontend version=2
  16. • PersistentVolume ◦ Independent lifecycle ◦ Dynamically Provisioned ◦ Storage

    Class + Capacity • PersistentVolumeClaim ◦ A claim to consume a matching PersistentVolume ◦ With a defined AccessMode • StorageClass ◦ Regional Persistent Disk ◦ SSD Disks Persistent Volumes
  17. • Manages Pods using a spec • Maintains an identity

    per Pod • Guarantees uniqueness and ordering • Ordering applies to deployment, scaling, and updates StatefulSet app-1 app-2
  18. • Stateless ◦ Pods added, removed, or restarted at will

    ◦ Individual Pods have no data to persist or concept of state • Stateful ◦ Pods require an identity ◦ Pods need to store data ◦ Deployment and scaling must be logically managed Stateless vs Stateful Applications
  19. • Data is encoded in etcd • Secrets can be

    encrypted. • Access to secrets can be restricted using RBAC Secrets
  20. • https://github.com/misskecupbung/gke-101 • http://misskecupbung.wordpress.com/ • https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture • https://cloud.google.com/kubernetes-engine/docs/concepts/deployment • https://cloud.google.com/kubernetes-engine/docs/concepts/service

    • https://cloud.google.com/kubernetes-engine/docs/how-to/updating-apps • https://cloud.google.com/solutions/implementing-deployment-and-testing-strategies-o n-gke • https://cloud.google.com/kubernetes-engine/docs/how-to/stateful-apps • https://cloud.google.com/kubernetes-engine/docs/concepts/storage-overview • https://cloud.google.com/kubernetes-engine/docs/concepts/secret • https://cloud.google.com/kubernetes-engine/docs/concepts/configmap References