Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Google Cloud Platform Kubernetes Workshop IYTE

236 views

Published on

Google Cloud Platform and Kubernetes all day workshop notes. Showing why we need Kubernetes and why we have to choose GCP as container engine.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Google Cloud Platform Kubernetes Workshop IYTE

  1. 1. Google Cloud Platform Kubernetes Workshop www.zetaops.io Simplicity is the ultimate sophistication Leonardo da Vinci“ “ 8 Kasım 2017, Çarşamba İYTE İnovasyon Merkezi
  2. 2. Shoshin (初心) is a concept in Zen Buddhism meaning "beginner's mind". It refers to having an attitude of openness, eagerness, and lack of preconceptions when studying a subject, even when studying at an advanced level, just as a beginner in that subject would.
  3. 3. Program ● 09:45 - 10:15, Önder Güler, Google Cloud Country Manager, Google Cloud Vizyonu ● 10:15 - 11:30, Pınar Uğurlu Kirazcı, Cloud Customer Engineer, Google, Google Cloud Servislerine Teknik Bakış ● 11:30 - 12:30, Gökhan Boranalp, Zetaops, Sanallaştırma temelleri, Virtual machines, LX{C,D} Containers, Unikernels ● 13:30 - 14:15, Gökhan Boranalp, Zetaops, GCloud sdk tanıtımı ● 14:30 - 15:45, Gökhan Boranalp, Zetaops, Kubernetes nedir? Bileşenleri nelerdir? ● 14:30 - 15:45, Pınar Uğurlu Kirazcı, Cloud Customer Engineer, Google, Kubernetes Fast Track Demo ● 15:30 - 16:30, Gökhan Boranalp, Zetaops, Kubernetes ile örnek bir dağıtık web uygulaması ● 16:45 - 17:15, Gökhan Boranalp, Zetaops, Soru cevap
  4. 4. Sanallaştırma Temelleri
  5. 5. Sanallaştırma Temelleri - Types ● Full virtualization: running an unmodified OS, Parallels, VirtualBox, XEN ● Paravirtualization: running a modified guest system (kernel), XEN, QEMU, KVM ● OS-level virtualization: enables running an isolated process (tree), OpenVZ, LXC, BSD-jails, Linux-VServer, Solaris Zones ● Virtualized Containers, LXC, LXD, Docker
  6. 6. Sanallaştırma Temelleri
  7. 7. Sanallaştırma Temelleri ● Sanal makinalar stateful ● Büyük VM’ler: Depolama VM içinde, tüm servisler aynı VM içinde, kocaman vCPU ve vRAM ● Uygulama SLA kuralları VM hayatta kalsın diye var. ● Dağıtıklık ve fail durumu için eldeki HA teknolojisine bağlı ● VM’ler kurulumdan sonra CPU ve RAM bakımından ölçeklenebilir. ● Uygulamalar VM’in crash olması durumuna göre geliştirilmemiştir. ● Örnek: Aynı VM üzerinde, database, web server, frontend app birlikte çalışıyor. ● Uygulamalar dağıtık olmak üzere tasarlanmıştır. VM’ler stateless haldedir. ● VM’ler küçüktür. ● Uygulama SLA kuralları tüm uygulama içindir. Bir VM için değil. ● Uygulama çok sayıda instance üzerinde çalışmaktadır. ● Uygulamanın ölçeklendirilmesi için anlık olarak VM eklenebilir. ● Uygulamalar VM’lerin fail olması durumuna göre geliştirilmiştir. PETS CATTLE
  8. 8. Sanallaştırma Temelleri
  9. 9. Sanallaştırma Temelleri
  10. 10. Sanallaştırma Temelleri - Docker ● Docker Engine - Runs on “Linux” to create the operating environment for your distributed applications. ● Docker Machine - Automate Docker provisioning. ● Docker Swarm - Docker Swarm is native clustering for Docker. It turns a pool of Docker hosts into a single, virtual Docker host.
  11. 11. Sanallaştırma Temelleri - Docker ● Docker Compose - Compose is a tool for defining and running multi-container Docker applications. ● Docker Registry - The Registry is a stateless, highly scalable server side application that stores and lets you distribute Docker images. ● Docker Toolbox - The Docker Toolbox is an installer to install and setup a Docker environment on your computer.
  12. 12. Sanallaştırma Temelleri - Docker ● Dockerfile anatomy ● Dockerfile example ● Docker registry ● Running Docker properly
  13. 13. Sanallaştırma Temelleri - Docker
  14. 14. Sanallaştırma Temelleri - Docker
  15. 15. GCloud SDK
  16. 16. GCloud SDK
  17. 17. GCloud SDK
  18. 18. GCloud SDK
  19. 19. GCloud SDK
  20. 20. GCloud SDK
  21. 21. GCloud SDK
  22. 22. GCloud SDK
  23. 23. GCloud SDK
  24. 24. GCloud SDK
  25. 25. GCloud SDK
  26. 26. GCloud SDK
  27. 27. GCloud SDK
  28. 28. GCloud SDK
  29. 29. GCloud SDK
  30. 30. GCloud SDK
  31. 31. GCloud SDK
  32. 32. GCloud SDK ● https://cloud.google.com/sdk/ ● https://cloud.google.com/sdk/gcloud/ref erence/ ● Örnek komutlar
  33. 33. Kubernetes
  34. 34. 12 factor https://12factor.net/
  35. 35. 12 factor
  36. 36. Mikro servisler
  37. 37. Kubernetes
  38. 38. Kubernetes
  39. 39. Kubernetes
  40. 40. Kubernetes
  41. 41. Kubernetes
  42. 42. Kubernetes
  43. 43. Kubernetes
  44. 44. Kubernetes
  45. 45. Kubernetes
  46. 46. Kubernetes
  47. 47. Kubernetes
  48. 48. Kubernetes
  49. 49. Kubernetes
  50. 50. Kubernetes
  51. 51. Hands on Kubernetes Master: Kubernetes control panel or control plane. This is where decisions are made about the cluster, such as scheduling, and detecting/responding to cluster events. The components of the master can be run on any node in the cluster. Key components of the master:
  52. 52. API Server — This is the only component of the Kubernetes control panel with a user-accessible API and the sole master component that you’ll interact with. The API server exposes a restful Kubernetes API and consumes JSON manifest files. Cluster State&Data Store — Kubernetes uses “etcd.” This is a strong consistent, and highly-available key value store that Kubernetes uses for persistent storage of all API objects. Think of it as the “source of truth” for the cluster. Hands on Kubernetes
  53. 53. Hands on Kubernetes Controller Manager — Known as the “kube-controller manager,” this runs all the controllers that handle routine tasks in the cluster. These include the Node Controller, Replication Controller, Endpoints Controller, and Service Account and Token Controllers. Each of these controllers works separately to maintain the desired state.
  54. 54. Hands on Kubernetes Scheduler — The scheduler watches for newly-created pods (groups of one or more containers) and assigns them to nodes. Dashboard (optional) — Kubernetes web UI that simplifies the Kubernetes cluster user’s interactions with the API server.
  55. 55. Kubernetes Worker Nodes Master handles and manages the cluster, worker nodes run the containers and provide the Kubernetes runtime environment. Worker nodes comprise a kubelet. This is the primary node agent. It watches the API server for pods that have been assigned to its node. Kubelet carries out tasks and maintains a reporting backchannel of pod status to the master node. Hands on Kubernetes
  56. 56. Hands on Kubernetes Inside each pod there are containers, kubelet runs these via Docker (pulling images, starting and stopping containers, etc.). It also periodically executes any requested container liveness probes. In addition to Docker, RKT is also supported and the community is actively working to support OCI. Another component of worker nodes is kube-proxy. This is the network brain of the node, maintaining network rules on the host and performing connection forwarding. It’s also responsible for load balancing across all pods in the service.
  57. 57. Kubernetes Pods A pod is a group of one or more containers (such as Docker containers), with shared storage/network. Each pod contains specific information on how the containers should be run. Think of pods as a ring-fenced environment to run containers. Pods are also a unit for scaling. If you need to scale an app component up or down, this can be achieved by adding or removing pods. Hands on Kubernetes
  58. 58. Hands on Kubernetes It’s possible to run more than one container in a pod (where each share the same IP address and mounted volumes), if they’re tightly coupled. Pods are deployed on a single node and have a definite lifecycle. They can be pending, running, succeeding, or failing, but once gone, they are never brought back to life. If a pod dies, a replication controller or other controller must be used to create a new one.
  59. 59. Pods — A description of a set of containers that need to run together. Services — An object that describes a set of pods that provide a useful service. Services are typically used to define clusters of uniform pods. Persistent Volumes — A Kubernetes abstraction for persistent storage. Kubernetes supports many types of volumes, such as NFS, Ceph, GlusterFS, local directory, etc. Hands on Kubernetes
  60. 60. Namespaces — This is a tool used to group, separate, and isolate groups of objects. Namespaces are used for access control, network access control, resource management, and quoting. Ingress rules — These specify how incoming network traffic should be routed to services and pods. Network policies — This defines the network access rules between pods inside the cluster. Hands on Kubernetes
  61. 61. ConfigMaps and Secrets — Used to separate configuration information from application definition. Controllers — These implement different policies for automatic pod management. There are three main types: 1. Deployment — Responsible for maintaining a set of running pods of the same type. 2. DaemonSet — Runs a specific type of pod on each node based on a condition. 3. StatefulSet — Used when several pods of the same type are needed to run in parallel, but each of the pods is required to have a specific identity. Hands on Kubernetes
  62. 62. Hands on Kubernetes ● Kubernetes simultaneously runs and controls a set of nodes on virtual or physical machines. ● This is achieved by running agents on each node. ● The agent talks to the master via the same API used to send the blueprint to Kubernetes. ● The agent registers itself in the master, providing Kubernetes with information about the nodes. ● Reading through the API, the agent determines which containers are required to run on the corresponding node and how they are to be configured.
  63. 63. Hands on Kubernetes ● The master node runs several Kubernetes components. ● Together, these make all control decisions about which container needs to be started on which node and how it should be configured. ● In addition, the master and agent may interact with a cloud provider and manage additional cloud resources such as load balancers, persistent volumes, persistent block storage, network configuration, and number of instances.
  64. 64. Hands on Kubernetes ● The master can be a single instance running Kubernetes components or a set of instances to ensure high availability. ● A master can also serve (in certain configurations) as a node to run containers, although this is not recommended for production. ★ Don’t run heavy duty databases in Kubernetes ★ Choose wisely your load balancer.
  65. 65. ● Running the Kubernetes cluster ○ Examples ■ https://cloud.google.com/container-engine/docs/ tutorials/hello-app ■ https://github.com/kubernetes/examples/blob/m aster/staging/spark/README.md ■ https://cloud.google.com/solutions/continuous-d elivery-jenkins-container-engine Hands on Kubernetes
  66. 66. Hands on Kubernetes Q: If Pods are ephemeral how can I persist my container data across container restarts? A: Kubernetes supports the concept of Volumes so you can use a Volume type that is persistent. Q: Do I create Pods manually, what if I want to create a few copies of the same container do I have to create each one individually? A: Replication Controller to rollout multiple copies using a Pod template Q: If Pods are ephemeral and their IP address might change if they get restarted how can I reliability reference my backend container from a frontend container? A: Use a Service
  67. 67. Soru, cevap http://goo.gl/slides/j6gx3q
  68. 68. Resources ● http://www.dummies.com/programming/networking/basics-of-network-virtualization/ ● https://12factor.net/ ● https://medium.com/jeroen-rosenberg/from-monolith-to-microservice-architecture-on-kubernetes-part-1-the-api-gateway-eb82f8c2d10c ● https://daemonza.github.io/2017/02/20/using-helm-to-deploy-to-kubernetes/ ● https://dzone.com/articles/microservices-with-kubernetes-and-docker ● https://medium.com/jeroen-rosenberg/from-monolith-to-microservice-architecture-on-kubernetes-part-1-the-api-gateway-eb82f8c2d10c ● https://techbeacon.com/one-year-using-kubernetes-production-lessons-learned ● https://github.com/wsargent/docker-cheat-sheet#dockerfile ● http://blog.kubernetes.io/2015/06/the-distributed-system-toolkit-patterns.html ● http://blog.flux7.com/blogs/docker/docker-tutorial-series-part-3-automation-is-the-word-using-dockerfile ● https://developers.google.com/apis-explorer/#search/compute/clouduseraccounts/alpha/ ● https://console.cloud.google.com/cloud-resource-manager ● https://alpinelinux.org/downloads/ ● http://phusion.github.io/baseimage-docker/ ● https://www.slideshare.net/randybias/the-history-of-pets-vs-cattle-and-using-it-properly ● http://cloudscaling.com/blog/cloud-computing/the-history-of-pets-vs-cattle/ ● https://www.discogs.com/Captain-Hook-And-His-Crew-Ship-Ahoy/release/5674030 ● http://thesecretlivesofdata.com/raft/ ● http://www.yamllint.com/ ● http://static.brandonpotter.com/kubernetes/DeploymentBuilder.html ● http://omerio.com/2015/12/18/learn-the-kubernetes-key-concepts-in-10-minutes/ ● https://youtu.be/9Wzw84Q-8yc ● https://kubernetes.io/docs/user-guide/kubectl-cheatsheet/ ● https://cloud.google.com/solutions/automated-build-images-with-jenkins-kubernetes ● https://cloud.google.com/container-builder/docs/quickstart-docker ● https://www.youtube.com/watch?v=xhwNywVYBk4

×