More Related Content


Recently uploaded(20)

Scaling Microservices with Kubernetes

  1. Scaling Microservices with Kubernetes
  2. Deivid Hahn Fração Web Developer
  3. Containers
  4. Microservices Challenges ▸ Infrastructure complexity ▸ Scaling ▸ Service discovery and routing ▸ Monitoring and logging
  5. Solution
  6. What is Kubernetes? "Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications."
  7. What is Kubernetes? ▸ Also known as k8s ▸ Inspired by the Google Borg system ▸ V1.0 released in July 2015 ▸ Google donated it to the Cloud Native Computing Foundation
  8. Kubernetes is... ▸ Portable: public, private, hybrid, multi-cloud ▸ Extensible: modular, pluggable, hookable, composable ▸ Self-healing: auto-placement, auto-restart, auto-replication, auto-scaling
  9. Architecture
  10. Kubectl ▸ Command line interface for running commands against Kubernetes clusters
  11. Dashboard
  12. Minikube ▸ Minikube is a tool that makes it easy to run Kubernetes locally ▸ It runs a single-node Kubernetes cluster inside a VM
  13. Components
  14. Master Components
  15. ▸ Exposes the Kubernetes API ▸ REST operations ▸ It is the front-end for the Kubernetes control plane kube-apiserver
  16. ▸ Kubernetes’ backing store ▸ All cluster data is stored here ▸ A multi-node cluster in production and back it up periodically is recommended. etcd
  17. ▸ Watches newly created pods that have no node assigned ▸ Selects the best node option for them to run kube-scheduler
  18. ▸ Run controllers that handle routine tasks kube-controller-manager cloud-controller-manager ▸ Run controllers that interact with cloud providers
  19. Node Components
  20. ▸ It watches for pods that have been assigned to its node ▸ Runs the pod and mount required volumes ▸ Downloads the pod’s secrets ▸ Reports the status of the node back to the rest of the system kubelet
  21. ▸ Maintain network rules kube-proxy
  22. Concepts
  23. Desired State ▸ Very important concept in the Kubernetes model ▸ It is Kubernetes’ responsibility to make sure that the current state matches the desired state
  24. Pod ▸ It contains one or more application containers, tightly coupled ▸ Containers within a pod share an IP address and port space, and can find each other via localhost
  25. Pod ▸ Pods are considered to be relatively ephemeral ▸ Normally used with controllers
  26. How to create a Pod?
  27. How to create a Pod?
  28. How to create a Pod?
  29. Describing a Pod
  30. Describing a Pod
  31. Describing a Pod
  32. Label ▸ Labels are key/value pairs that are attached to objects, such as pods ▸ Labels can be used to organize and to select subsets of objects
  33. Liveness Probe ▸ The kubelet uses liveness probes to know when to restart a Container
  34. Liveness Probe
  35. Readiness probe ▸ The kubelet uses readiness probes to know when a Container is ready to start accepting traffic ▸ A Pod is considered ready when all of its Containers are ready ▸ When a Pod is not ready, it is removed from Service load balancers
  36. Readiness probe
  37. Readiness / liveness probe fields ▸ initialDelaySeconds: Number of seconds after the container has started before liveness or readiness probes are initiated ▸ periodSeconds: How often (in seconds) to perform the probe
  38. Readiness / liveness probe fields ▸ successThreshold: Minimum consecutive successes for the probe to be considered successful after having failed ▸ failureThreshold: Minimum consecutive failures for the probe to be considered unhealthy
  39. ▸ Pods are mortal ▸ Each Pod has a unique IP address, but those IPs are not exposed outside the cluster. ▸ A service defines a logical set of Pods and a policy by which to access them Services
  40. ▸ ClusterIP (default): Exposes the Service on an internal IP in the cluster ▸ NodePort: Exposes the Service on the same port of each selected Node in the cluster Services - Types
  41. ▸ LoadBalancer - Creates an external load balancer in the current cloud (if supported) and assigns a fixed, external IP to the Service ▸ ExternalName - Exposes the Service using an arbitrary name (e.g. Services - Types
  42. Services
  43. Replication Controller ▸ Replication Controller ensures that a specified number of pod replicas are running at any one time ▸ If there are too many pods, the ReplicationController terminates the extra pods. If there are too few, the ReplicationController starts more pods.
  44. Replication Controller
  45. Replication Controller
  46. Replication Controller
  47. Replication Controller
  48. Replica Set ▸ Next-generation Replication Controller ▸ The difference between a ReplicaSet and a Replication Controller right now is the selector support
  49. Replica Set
  50. Replica Set
  51. Replica Set
  52. Deployments ▸ A Deployment controller provides declarative updates for Pods and ReplicaSets ▸ Recommended way
  53. Deployments
  54. Deployments
  55. Deployments
  56. Deployments
  57. Deployments
  58. Deployments
  59. Namespace ▸ Namespaces are intended for use in environments with many users spread across multiple teams, or projects ▸ Names of resources need to be unique within a namespace, but not across namespaces
  60. Namespace
  61. Secrets ▸ Passwords, OAuth tokens, and ssh keys ▸ A secret can be used with a pod in two ways: as files in a volume mounted on one or more of its containers, or used by kubelet when pulling images for the pod
  62. Secrets
  63. Secrets in a Pod
  64. Using Secrets as Environment Variables
  65. ConfigMap ▸ Key-value pairs of configuration data that can be consumed in pod ▸ ConfigMap is similar to Secrets, but it do not contain sensitive information
  66. THANKS!