SlideShare une entreprise Scribd logo
1  sur  49
Kubernetes 101
Huy Vo, Engineering Manager
Huy Vo
• Engineering Manager
Axon
Outline
• What and Why
• Basic Components
• How to deploy app to k8s
• Demo
• Advance
What is Kubernetes?
Traditional to Modern
Container are great but…
• Isolation.
• Immutability
• Efficient resource
utilization.
• Lightweight
• Portable
But …
• Dozens, even thousands of
containers over time.
• How to
manage/deploy/connected/up
dated ?
• Integrate and orchestrate
these modular parts
• Provide communication
across a cluster
• Make them fault tolerant
Kubernetes come to help
• Desire state
management.
• Resilience.
• Automate roll-out and
roll-back.
• Elastic.
• Cloud-agnostic.
• Efficient resource
management.
• Abstract infrastructure
layer.
Core
Component
Pod
• The smallest and
simplest unit in the
Kubernetes object model.
• Containers in pods share
network namespace,
volume.
• Pods are logical hosts
and behave much like
VMs
Pod template
• 1 Descriptor conforms to
version v1 of Kubernetes API
• 2 You’re describing a pod.
• 3 The name of the pod
• 4 Container image to create
the container from
• 5 Name of the container
• 6 The port the app is listening
on
Organize Pod with label
Liveness probes
Kubernetes can check if a container is still
alive through liveness probes. 3 mechanisms:
• HTTP GET probe.
• TCP socket probe.
• Exec probe.
ReplicaSet
A Kubernetes resource that
ensures its pods are always
kept running. Has 3 essential
parts:
• A label selector, which
determines what pods are in
the Replicationset ’s scope
• A replica count, which
specifies the desired number
of pods that should be
running
• A pod template, which is
used when creating new pod
replicas
Replicaset template
Daemonset
• A DaemonSet makes sure it
creates as many pods as
there are nodes and deploys
each one on its own node.
• Example:
• a log collector
• a resource monitor
• Kube proxy
Daemonset template
Job
• Perform a single completable
task.
• Useful for ad hoc tasks,
where it’s crucial that the
task finishes properly.
Service
• Pods are ephemeral.
• Horizontal scaling
means multiple pods
may provide the same
service
• a Service is an abstraction which
defines a logical set of Pods.
• The set of Pods targeted by a Service
is usually determined by a selector.
• Each service has an IP address and
port that never change while the
service exists.
Service
3 types:
• ClusterIP: use for internal cluster, discovering by
DNS. Example: mdt-detector.redaction
• NodePort: each cluster node opens a port on the
node itself (hence the name) and redirects traffic
received on that port to the underlying service
• LoadBalancer: an extension of
the NodePort type
Exposing service
Readiness probe
Like liveness probes, three
types of readiness probes
exist:
• HTTP GET probe
• TCP socket probe
• Exec probe
Ingress
• How to expose multiple
service?
• Service is L4 proxy.
• SSL?
Ingress
• name-based virtual hosting
• Load-balancing
• SSL terminating
• L7 proxy
How Ingress work
Deployment
• A higher-level resource meant
for deploying applications and
updating them declaratively.
• Create a Deployment, a
ReplicaSet resource is
created underneath.
• In a Deployment, the actual
pods are created and
managed by the
Deployment’s ReplicaSets
• Deployment provide the
capability upgrade without
downtime.
Deployment template
Strategy Update
RollingUpdate Recreate
Statefulset
A StatefulSet makes sure pods are rescheduled in such a way that
they retain their identity and state
You can reach the pod through its fully qualified domain
name, which is a-0.foo.default.svc.cluster.local.
Volume
Configmap
Configmap is a map containing key/value pairs with the values ranging from short literals to full config files.
Resource limits
How to deploy
app to k8s
Bring everything together
Basic step
• Dockerize.
• Write deployment/service.
• Define configmap or variable
env.
• Resource usage.
• Liveness/Ready probe.
• Helm chart
• How to structure application into
pods? Multiple container in 1 pod
or multiple pod?
• How to integrate with other
service?
• Does it need to communicate
with outside?
• Does it need stateful?
• How to integrate with Ecom?
Helm
• Helm helps you manage Kubernetes
applications — Helm Charts help you
define, install, and upgrade even the
most complex Kubernetes application.
• Charts are easy to create, version,
share, and publish — so start using
Helm and stop the copy-and-paste.
Helm example
Deployment.yaml values.yaml
Demo
Advance
The Architecture
API server
API server is the central component used by all other components and by clients, such
as kubectl. It provides a CRUD (Create, Read, Update, Delete) interface for querying
and modifying the cluster state over a RESTful API. It stores that state in etcd.
API server
Scheduler
• Filtering the list of all nodes to obtain a list of
acceptable nodes the pod can be scheduled to
• Prioritizing the acceptable nodes and choosing the best
one. If multiple nodes have the highest score, round-
robin is used to ensure pods are deployed across all of
them evenly.
Controller Manager
• ReplicaSet, DaemonSet, and
Job controllers.
• Deployment controller.
• StatefulSet controller.
• Node controller.
• Service controller.
• Others
Controllers do many different things, but they all watch the
API server for changes to resources (Deployments,
Services, and so on) and perform operations for each
change, whether it’s a creation of a new object or an
update or deletion of an existing object.
Kubelet
Kube-proxy
The iptables proxy mode doesn’t—it selects pods randomly. When only a few clients use a
service, they may not be spread evenly across pods. For example, if a service has two backing
pods but only five or so clients, don’t be surprised if you see four clients connect to pod A and
only one client connect to pod B. With a higher number of clients or pods, this problem isn’t so
apparent.
kube-proxy makes sure connections to the service IP and
port end up at one of the pods backing that service
How they cooperate
Horizontal Pod Autoscaler
Cluster Autoscaler
Autoscalers Interact Together
QUESTIONS?

Contenu connexe

Tendances

Tendances (20)

Deploy Application on Kubernetes
Deploy Application on KubernetesDeploy Application on Kubernetes
Deploy Application on Kubernetes
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)
 
Introduction to openshift
Introduction to openshiftIntroduction to openshift
Introduction to openshift
 
Kubernetes Architecture
 Kubernetes Architecture Kubernetes Architecture
Kubernetes Architecture
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Introduction of Kubernetes - Trang Nguyen
Introduction of Kubernetes - Trang NguyenIntroduction of Kubernetes - Trang Nguyen
Introduction of Kubernetes - Trang Nguyen
 
Introduction to helm
Introduction to helmIntroduction to helm
Introduction to helm
 
Introduction to Kubernetes with demo
Introduction to Kubernetes with demoIntroduction to Kubernetes with demo
Introduction to Kubernetes with demo
 
Gitlab, GitOps & ArgoCD
Gitlab, GitOps & ArgoCDGitlab, GitOps & ArgoCD
Gitlab, GitOps & ArgoCD
 
GitOps with ArgoCD
GitOps with ArgoCDGitOps with ArgoCD
GitOps with ArgoCD
 
Meetup 23 - 03 - Application Delivery on K8S with GitOps
Meetup 23 - 03 - Application Delivery on K8S with GitOpsMeetup 23 - 03 - Application Delivery on K8S with GitOps
Meetup 23 - 03 - Application Delivery on K8S with GitOps
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
GitOps - Operation By Pull Request
GitOps - Operation By Pull RequestGitOps - Operation By Pull Request
GitOps - Operation By Pull Request
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Gitops: a new paradigm for software defined operations
Gitops: a new paradigm for software defined operationsGitops: a new paradigm for software defined operations
Gitops: a new paradigm for software defined operations
 
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation SlidesKubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
 
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
 
Free GitOps Workshop + Intro to Kubernetes & GitOps
Free GitOps Workshop + Intro to Kubernetes & GitOpsFree GitOps Workshop + Intro to Kubernetes & GitOps
Free GitOps Workshop + Intro to Kubernetes & GitOps
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
 

Similaire à Kubernetes 101

How kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updatedHow kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updated
Shikha Srivastava
 
Kubernetes: від знайомства до використання у CI/CD
Kubernetes: від знайомства до використання у CI/CDKubernetes: від знайомства до використання у CI/CD
Kubernetes: від знайомства до використання у CI/CD
Stfalcon Meetups
 

Similaire à Kubernetes 101 (20)

01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
 
Container Conf 2017: Rancher Kubernetes
Container Conf 2017: Rancher KubernetesContainer Conf 2017: Rancher Kubernetes
Container Conf 2017: Rancher Kubernetes
 
DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to Kubernetes
 
Kubernetes intro
Kubernetes introKubernetes intro
Kubernetes intro
 
Kubernetes Internals
Kubernetes InternalsKubernetes Internals
Kubernetes Internals
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Cloud technology with practical knowledge
Cloud technology with practical knowledgeCloud technology with practical knowledge
Cloud technology with practical knowledge
 
Kubernetes overview and Exploitation
Kubernetes overview and ExploitationKubernetes overview and Exploitation
Kubernetes overview and Exploitation
 
How kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updatedHow kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updated
 
Kubernetes: від знайомства до використання у CI/CD
Kubernetes: від знайомства до використання у CI/CDKubernetes: від знайомства до використання у CI/CD
Kubernetes: від знайомства до використання у CI/CD
 
Kubernetes presentation
Kubernetes presentationKubernetes presentation
Kubernetes presentation
 
Kubernetes-Meetup
Kubernetes-MeetupKubernetes-Meetup
Kubernetes-Meetup
 
01. Kubernetes-PPT.pptx
01. Kubernetes-PPT.pptx01. Kubernetes-PPT.pptx
01. Kubernetes-PPT.pptx
 
Moving Applications into Azure Kubernetes
Moving Applications into Azure KubernetesMoving Applications into Azure Kubernetes
Moving Applications into Azure Kubernetes
 
Why kubernetes for Serverless (FaaS)
Why kubernetes for Serverless (FaaS)Why kubernetes for Serverless (FaaS)
Why kubernetes for Serverless (FaaS)
 
Kubernetes for Serverless - Serverless Summit 2017 - Krishna Kumar
Kubernetes for Serverless  - Serverless Summit 2017 - Krishna KumarKubernetes for Serverless  - Serverless Summit 2017 - Krishna Kumar
Kubernetes for Serverless - Serverless Summit 2017 - Krishna Kumar
 
Kubernetes overview 101
Kubernetes overview 101Kubernetes overview 101
Kubernetes overview 101
 
Kubernetes Fundamentals on Azure 2017
Kubernetes Fundamentals on Azure 2017Kubernetes Fundamentals on Azure 2017
Kubernetes Fundamentals on Azure 2017
 
Intro to kubernetes
Intro to kubernetesIntro to kubernetes
Intro to kubernetes
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 

Dernier

+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
Health
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 

Dernier (20)

+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 

Kubernetes 101

  • 1. Kubernetes 101 Huy Vo, Engineering Manager
  • 2. Huy Vo • Engineering Manager Axon
  • 3. Outline • What and Why • Basic Components • How to deploy app to k8s • Demo • Advance
  • 6. Container are great but… • Isolation. • Immutability • Efficient resource utilization. • Lightweight • Portable But … • Dozens, even thousands of containers over time. • How to manage/deploy/connected/up dated ? • Integrate and orchestrate these modular parts • Provide communication across a cluster • Make them fault tolerant
  • 7. Kubernetes come to help • Desire state management. • Resilience. • Automate roll-out and roll-back. • Elastic. • Cloud-agnostic. • Efficient resource management. • Abstract infrastructure layer.
  • 9. Pod • The smallest and simplest unit in the Kubernetes object model. • Containers in pods share network namespace, volume. • Pods are logical hosts and behave much like VMs
  • 10. Pod template • 1 Descriptor conforms to version v1 of Kubernetes API • 2 You’re describing a pod. • 3 The name of the pod • 4 Container image to create the container from • 5 Name of the container • 6 The port the app is listening on
  • 12. Liveness probes Kubernetes can check if a container is still alive through liveness probes. 3 mechanisms: • HTTP GET probe. • TCP socket probe. • Exec probe.
  • 13. ReplicaSet A Kubernetes resource that ensures its pods are always kept running. Has 3 essential parts: • A label selector, which determines what pods are in the Replicationset ’s scope • A replica count, which specifies the desired number of pods that should be running • A pod template, which is used when creating new pod replicas
  • 15. Daemonset • A DaemonSet makes sure it creates as many pods as there are nodes and deploys each one on its own node. • Example: • a log collector • a resource monitor • Kube proxy
  • 17. Job • Perform a single completable task. • Useful for ad hoc tasks, where it’s crucial that the task finishes properly.
  • 18. Service • Pods are ephemeral. • Horizontal scaling means multiple pods may provide the same service • a Service is an abstraction which defines a logical set of Pods. • The set of Pods targeted by a Service is usually determined by a selector. • Each service has an IP address and port that never change while the service exists.
  • 19. Service 3 types: • ClusterIP: use for internal cluster, discovering by DNS. Example: mdt-detector.redaction • NodePort: each cluster node opens a port on the node itself (hence the name) and redirects traffic received on that port to the underlying service • LoadBalancer: an extension of the NodePort type
  • 21. Readiness probe Like liveness probes, three types of readiness probes exist: • HTTP GET probe • TCP socket probe • Exec probe
  • 22. Ingress • How to expose multiple service? • Service is L4 proxy. • SSL? Ingress • name-based virtual hosting • Load-balancing • SSL terminating • L7 proxy
  • 24. Deployment • A higher-level resource meant for deploying applications and updating them declaratively. • Create a Deployment, a ReplicaSet resource is created underneath. • In a Deployment, the actual pods are created and managed by the Deployment’s ReplicaSets • Deployment provide the capability upgrade without downtime.
  • 27. Statefulset A StatefulSet makes sure pods are rescheduled in such a way that they retain their identity and state You can reach the pod through its fully qualified domain name, which is a-0.foo.default.svc.cluster.local.
  • 29. Configmap Configmap is a map containing key/value pairs with the values ranging from short literals to full config files.
  • 33. Basic step • Dockerize. • Write deployment/service. • Define configmap or variable env. • Resource usage. • Liveness/Ready probe. • Helm chart • How to structure application into pods? Multiple container in 1 pod or multiple pod? • How to integrate with other service? • Does it need to communicate with outside? • Does it need stateful? • How to integrate with Ecom?
  • 34. Helm • Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application. • Charts are easy to create, version, share, and publish — so start using Helm and stop the copy-and-paste.
  • 36. Demo
  • 39. API server API server is the central component used by all other components and by clients, such as kubectl. It provides a CRUD (Create, Read, Update, Delete) interface for querying and modifying the cluster state over a RESTful API. It stores that state in etcd.
  • 41. Scheduler • Filtering the list of all nodes to obtain a list of acceptable nodes the pod can be scheduled to • Prioritizing the acceptable nodes and choosing the best one. If multiple nodes have the highest score, round- robin is used to ensure pods are deployed across all of them evenly.
  • 42. Controller Manager • ReplicaSet, DaemonSet, and Job controllers. • Deployment controller. • StatefulSet controller. • Node controller. • Service controller. • Others Controllers do many different things, but they all watch the API server for changes to resources (Deployments, Services, and so on) and perform operations for each change, whether it’s a creation of a new object or an update or deletion of an existing object.
  • 44. Kube-proxy The iptables proxy mode doesn’t—it selects pods randomly. When only a few clients use a service, they may not be spread evenly across pods. For example, if a service has two backing pods but only five or so clients, don’t be surprised if you see four clients connect to pod A and only one client connect to pod B. With a higher number of clients or pods, this problem isn’t so apparent. kube-proxy makes sure connections to the service IP and port end up at one of the pods backing that service

Notes de l'éditeur

  1.  Developers are lazy and somewhere in the mid-late 80s they started abbreviating the words based on their first letter, last letter, and number of letters in between. This is why you’ll sometimes see i18n for internationalization and l10n for localization. There are also new numeronyms such as Andreessen Horowitz (a16z) and of course our favorite kubernetes (k8s). I18n= internationalization L10n = localization K8s = kubernetes O11y = observability
  2. Containers are great. They provide you with an easy way to package and deploy services, allow for process isolation, immutability, efficient resource utilization, and are lightweight in creation. A container has its own filesystem, CPU, memory, process space, and more. As they are decoupled from the underlying infrastructure, they are portable across clouds and OS distributions. They provide you with an easy way to package and deploy services, allow for process isolation, immutability, efficient resource utilization, and are lightweight in creation. containers are only a low-level piece of the puzzle. The real benefits are obtained with tools that sit on top of containers — like Kubernetes. These tools are today known as container schedulers.
  3. The basic idea of Kubernetes is to further abstract machines, storage, and networks away from their physical implementation. So it is a single interface to deploy containers to all kinds of clouds, virtual machines, and physical machines.
  4. All pods in a Kubernetes cluster reside in a single flat, shared, network-address space which means every pod can access every other pod at the other pod’s IP address. No NAT (Network Address Translation) gateways exist between them. When two pods send network packets between each other, they’ll each see the actual IP address of the other as the source IP in the packet. pods are logical hosts and behave much like physical hosts or VMs in the non-container world. Processes running in the same pod are like processes running on the same physical or virtual machine, except that each process is encapsulated in a container.
  5. Kubernetes can check if a container is still alive through liveness probes Kubernetes can probe a container using one of the three mechanisms: An HTTP GET probe performs an HTTP GET request on the container’s IP address, a port and path you specify. If the probe receives a response, and the response code doesn’t represent an error (in other words, if the HTTP response code is 2xx or 3xx), the probe is considered successful. If the server returns an error response code or if it doesn’t respond at all, the probe is considered a failure and the container will be restarted as a result. A TCP Socket probe tries to open a TCP connection to the specified port of the container. If the connection is established successfully, the probe is successful. Otherwise, the container is restarted. An Exec probe executes an arbitrary command inside the container and checks the command’s exit status code. If the status code is 0, the probe is successful. All other codes are considered failures. Default probed every 10s container is restarted after the probe fails three consecutive times (#failure=3).
  6. If the pod disappears for any reason, such as in the event of a node disappearing from the cluster or because the pod was evicted from the node, the Replicaset notices the missing pod and creates a replacement pod.
  7. Service discovery and Load Balancing may be managed by a Service object. Services provide a single virtual IP address and dns name load balanced to a collection of Pods matching Labels. Service is a resource you create to make a single, constant point of entry to a group of pods providing the same service. Each service has an IP address and port that never change while the service exists. Clients can open connections to that IP and port, and those connections are then routed to one of the pods backing that service. This way, clients of a service don’t need to know the location of individual pods providing the service, allowing those pods to be moved around the cluster at any time.
  8. Ingress (noun)—The act of going in or entering; the right to enter; a means or place of entering; entryway.
  9. The controller determined which service the client is trying to access, looked up the pod IPs through the Endpoints object associated with the service, and forwarded the client’s request to one of the pods. Ingress controller didn’t forward the request to the service. It only used it to select a pod. Most, if not all, controllers work like this. Ingress controller: actually is an application in k8s with deployment and services.
  10. a volume is created when the pod is started and is destroyed when the pod is deleted. Because of this, a volume’s contents will persist across container restarts. After a container is restarted, the new container can see all the files that were written to the volume by the previous container. Also, if a pod contains multiple containers, the volume can be used by all of them at once. volumes are a component of a pod and are thus defined in the pod’s specification—much like containers. They aren’t a standalone Kubernetes object and cannot be created or deleted on their own. A volume is available to all containers in the pod, but it must be mounted in each container that needs to access it. In each container, you can mount the volume in any location of its filesystem.
  11. Components of the Control Plane The Control Plane is what controls and makes the whole cluster function. To refresh your memory, the components that make up the Control Plane are The etcd distributed persistent storage The API server The Scheduler The Controller Manager These components store and manage the state of the cluster, but they aren’t what runs the application containers. Components running on the worker nodes The task of running your containers is up to the components running on each worker node: The Kubelet The Kubernetes Service Proxy (kube-proxy) The Container Runtime (Docker, rkt, or others) Add-on components Beside the Control Plane components and the components running on the nodes, a few add-on components are required for the cluster to provide everything discussed so far. This includes The Kubernetes DNS server The Dashboard An Ingress controller
  12. The API server doesn’t do anything else except what we’ve discussed. For example, it doesn’t create pods when you create a ReplicaSet resource and it doesn’t manage the endpoints of a service. That’s what controllers in the Controller Manager do. But the API server doesn’t even tell these controllers what to do. All it does is enable those controllers and other components to observe changes to deployed resources. A Control Plane component can request to be notified when a resource is created, modified, or deleted. This enables the component to perform whatever task it needs in response to a change of the cluster metadata. Clients watch for changes by opening an HTTP connection to the API server. Through this connection, the client will then receive a stream of modifications to the watched objects. Every time an object is updated, the server sends the new version of the object to all connected clients watching the object. Figure 11.4 shows how clients can watch for changes to pods and how a change to one of the pods is stored into etcd and then relayed to all clients watching pods at that moment.
  13. Can the node fulfill the pod’s requests for hardware resources Is the node running out of resources (is it reporting a memory or a disk pressure condition)? If the pod requests to be scheduled to a specific node (by name), is this the node? Does the node have a label that matches the node selector in the pod specification (if one is defined)? If the pod requests to be bound to a specific host port is that port already taken on this node or not? If the pod requests a certain type of volume, can this volume be mounted for this pod on this node, or is another pod on the node already using the same volume? Does the pod tolerate the taints of the node? Does the pod specify node and/or pod affinity or anti-affinity rules? If yes, would scheduling the pod to this node break those rules? 
  14. HPA continuously checks metrics values you configure during setup AT A DEFAULT 30 SEC intervals HPA attempts to increase the number of pods If the SPECIFIED threshold is met HPA mainly updates the number of replicas inside the deployment or replication controller The Deployment/Replication Controller WOULD THEN roll-out ANY additional needed pods Consider these as you rollout HPA: The default HPA check interval is 30 seconds. This can be configured through the — horizontal-pod-autoscaler-sync-period flag of the controller manager Default HPA relative metrics tolerance is 10% HPA waits for 3 minutes after the last scale-up events to allow metrics to stabilize. This can also be configured through — horizontal-pod-autoscaler-upscale-delay flag HPA waits for 5 minutes from the last scale-down event to avoid autoscaler thrashing. Configurable through — horizontal-pod-autoscaler-downscale-delay flag HPA works best with deployment objects as opposed to replication controllers. Does not work with rolling update using direct manipulation of replication controllers. It depends on the deployment object to manage the size of underlying replica sets when you do a deployment
  15. The CA checks for pods in pending state at a default interval of 10 seconds. When If there is one or more pods in pending state because of there are not enough available resources on the cluster to allocate on the cluster them, then it attempts to provision one or more additional nodes. When the node is granted by the cloud provider, the node is joined to the cluster and becomes ready to serve pods. Kubernetes scheduler allocates the pending pods to the new node. If some pods are still in pending state, the process is repeated and more nodes are added to the cluster.