SlideShare a Scribd company logo
Someone is 👀 you
Kubernetes APIs and Watch Events Explained
Oliver Moser
The Guy
2
- TU Wien PhD
- Braintribe, Inc.
- Cloud / Automation / SRE
The Talk
3
- Kubernetes APIs
- Watch Events
- Live Examples
Kubernetes APIs
Kubernetes
API
5
- Resource-based programmable
interface for container workloads
- HTTP based API
- Entrypoint into Kubernetes
- Lives in the kube-apiserver
Kubernetes Components
kube-apiserver
kubelet
kube-scheduler
kube-controller-manager
kube-proxy
Master Nodes
Components
Worker Nodes
Components
Kubernetes Components
kube-apiserver
kubelet
kube-scheduler
kube-controller-manager
kube-proxy
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx
/api/v1/namespaces/default/pods/nginx
Kubernetes Components
kube-apiserver
kubelet
kube-scheduler
kube-controller-manager
kube-proxy
WATCH /api/v1/watch/pods
pod.nodeName == nil
pod.nodeName == nil
pod.nodeName == NodeB
Kubernetes Components
kube-apiserver
kubelet
kube-scheduler
kube-controller-manager
kube-proxy
WATCH /apis/apps/v1/watch/replicasets
WATCH /api/v1/watch/pods
replicaset-controller
WATCH /api/v1/watch/namespaces
namespace-controller
certificate-controller
cronjob-controller
endpoint-controller
node-lifecycle-controller
...
Kubernetes Components
kube-apiserver
kubelet
kube-scheduler
kube-controller-manager
kube-proxy
WATCH /api/v1/watch/pods
FILTER pod.spec.nodeName == Node A
Kubernetes Components
kube-apiserver
kubelet
kube-scheduler
kube-controller-manager
kube-proxy
WATCH /api/v1/watch/services
FILTER pod.spec.nodeName == Node A
Kubernetes API Structure
{paths: [
/api,
/api/v1,
/apis,
/apis/,
/apis/admission.certmanager.k8s.io,
/apis/admission.certmanager.k8s.io/v1beta1,
/apis/admissionregistration.k8s.io,
/apis/admissionregistration.k8s.io/v1beta1,
/apis/apiextensions.k8s.io,
/apis/apiextensions.k8s.io/v1beta1,
/apis/apiregistration.k8s.io,
/apis/apiregistration.k8s.io/v1,
/apis/apiregistration.k8s.io/v1beta1,
/apis/apps,
/apis/apps/v1,
/apis/apps/v1beta1,
/apis/apps/v1beta2,
/apis/authentication.k8s.io,
/apis/authentication.k8s.io/v1,
…
]}
> kubectl proxy &
> curl localhost:8001
Kubernetes API Structure
stolen from: https://blog.openshift.com/kubernetes-deep-dive-api-server-part-1/
Kubernetes API Structure
{
kind: APIGroup,
apiVersion: v1,
name: apps,
versions: [
{
groupVersion: apps/v1,
version: v1
},
{
groupVersion: apps/v1beta2,
version: v1beta2
},
{
groupVersion: apps/v1beta1,
version: v1beta1
}
],
preferredVersion: {
groupVersion: apps/v1,
version: v1
}
}
> kubectl proxy &
> curl localhost:8001/apis/apps
Kubernetes API Structure
{
kind: APIResourceList,
apiVersion: v1,
groupVersion: apps/v1,
resources: [
...
{
name: deployments,
singularName: ,
namespaced: true,
kind: Deployment,
verbs: [
create,
delete,
get,
list,
patch,
update,
watch
],
shortNames: [
deploy
],
...
}
> kubectl proxy &
> curl localhost:8001/apis/apps/v1
Kubernetes API Structure {
kind: DeploymentList,
apiVersion: apps/v1,
metadata: {
selfLink: /apis/apps/v1/deployments,
resourceVersion: 242895786
},
items: [
{
metadata: {
name: phoenix-dev-adx-cartridge,
namespace: adx,
selfLink: /apis/apps/v1/namespaces/...,
uid: 9972a409-ef77-11e9-8904-42010a9c00ae,
resourceVersion: 241706486,
generation: 1,
creationTimestamp: 2019-10-15T18:14:16Z,
labels: {
app: adx-cartridge,
initiative: phoenix,
runtime: phoenix-dev,
stage: dev,
workspace: adx
},
...
> kubectl proxy &
> curl localhost:8001/apis/apps/v1/deployments
/apis/
apps/v1/
namespaces/default/
deployments/nginx
Version
Group
metadata.namespace
Kind
metadata.name
spec.scope: Namespaced
/apis/apps/v1/namespaces/default/deployments/nginx
Kubernetes Resource Naming: Group Version Kind
- Each Kubernetes Object has a resourceVersion
- Used for optimistic locking/ concurrency control
Kubernetes Resource Versioning
metadata.resourceVersion: 1492311
spec.image: nginx:1.13.2
metadata.resourceVersion: 1492918
spec.image: nginx:1.13.3
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: default
resourceVersion:
1492311
spec:
containers:
- image:
nginx:1.13.3
name:
nginx
Kubernetes Watch Events
Watch Events: Incremental State Change Notifications
kube-apiserver kube-scheduler
GET /api/v1/pods?watch=true
metadata.resourceVersion: 1503831
status: {
phase: Pending,
qosClass: BestEffort
}
metadata.resourceVersion: 1503832
nodeName: nodeA
status: {
phase: Pending,
conditions: [
{
type: PodScheduled,
status: True,
…
}
],
}
metadata.resourceVersion: 1503851
nodeName: nodeA
status: {
phase: Running,
conditions: [
{
type: ContainersReady,
status: True,
…
}
],
}
MODIFIEDADDED MODIFIED
time
Watch Events: Type Definition
type WatchEvent struct {
// The type of the watch event; added, modified, deleted, or error.
// +optional
Type watch.EventType `json:type,omitempty description:the type of watch event; may be ADDED,
MODIFIED, DELETED, BOOKMARK or ERROR`
// For added or modified objects, this is the new object; for deleted objects,
// it's the state of the object immediately prior to its deletion.
// For errors, it's an api.Status.
// +optional
Object runtime.RawExtension `json:object,omitempty description:the object being watched;
will match the type of the resource endpoint or be a Status object if the type is ERROR`
}
Watch Events: Build up State
Type: ModifiedType: Added
time
Type: Modified Type: Deleted
Watch Events: Change Propagation
time
“delta
propagation”
“full-state
propagation”
{
"operation": "add",
"field": "replicas",
"value": 2
}
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "calico-typha",
"namespace": "kube-system"
...
},
"spec": {
"replicas": 2,
...
}
}
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "calico-typha",
"namespace": "kube-system"
...
},
"spec": {
"replicas": 1,
...
}
}
{
"operation": "del",
"field": "replicas",
"value": 1
}
Watch Events: Change Propagation
time
{
"operation": "add",
"field": "replicas",
"value": 2
}
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "calico-typha",
"namespace": "kube-system"
...
},
"spec": {
"replicas": 2,
...
}
}
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "calico-typha",
"namespace": "kube-system"
...
},
"spec": {
"replicas": 1,
...
}
}
{
"operation": "del",
"field": "replicas",
"value": 1
}
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "calico-typha",
"namespace": "kube-system"
...
},
"spec": {
"replicas": 4,
...
}
}
{
"operation": "add",
"field": "replicas",
"value": 3
}
replicas:=4
replicas:=4
Watch Events: Change Propagation
time
{
"operation": "add",
"field": "replicas",
"value": 2
}
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "calico-typha",
"namespace": "kube-system"
...
},
"spec": {
"replicas": 2,
...
}
}
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "calico-typha",
"namespace": "kube-system"
...
},
"spec": {
"replicas": 1,
...
}
}
{
"operation": "del",
"field": "replicas",
"value": 1
}
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "calico-typha",
"namespace": "kube-system"
...
},
"spec": {
"replicas": 4,
...
}
}
{
"operation": "add",
"field": "replicas",
"value": 3
}
lost update!
replicas:=5
replicas:=5
Live Examples
The End
27
Thank You
Watch Events: Edge Triggered vs Level Triggered
Signal Rise
Signal FallEdge
Triggered
Level
Triggered
Signal High
Signal Low
Watch Events: Edge Triggered vs Level Triggered
add 2
replicas
remove 1
replica
Edge
Triggered
Level
Triggered
replicas:=4
replicas:=3
replicas:=2 replicas:=3
Watch Events: Edge Triggered vs Level Triggered
add 2
replicas
remove 1
replica
Edge
Triggered
Level
Triggered
replicas:=3
replicas:=2
replicas:=1
replicas:=4
replicas:=3
lost update!

More Related Content

What's hot

Building a Serverless company with Node.js, React and the Serverless Framewor...
Building a Serverless company with Node.js, React and the Serverless Framewor...Building a Serverless company with Node.js, React and the Serverless Framewor...
Building a Serverless company with Node.js, React and the Serverless Framewor...Luciano Mammino
 
Extending Kubernetes with Operators
Extending Kubernetes with OperatorsExtending Kubernetes with Operators
Extending Kubernetes with Operatorspeychevi
 
From Spring Boot 2.2 to Spring Boot 2.3 #jsug
From Spring Boot 2.2 to Spring Boot 2.3 #jsugFrom Spring Boot 2.2 to Spring Boot 2.3 #jsug
From Spring Boot 2.2 to Spring Boot 2.3 #jsugToshiaki Maki
 
API Days Australia - Automatic Testing of (RESTful) API Documentation
API Days Australia  - Automatic Testing of (RESTful) API DocumentationAPI Days Australia  - Automatic Testing of (RESTful) API Documentation
API Days Australia - Automatic Testing of (RESTful) API DocumentationRouven Weßling
 
Building and running Spring Cloud-based microservices on AWS ECS
Building and running Spring Cloud-based microservices on AWS ECSBuilding and running Spring Cloud-based microservices on AWS ECS
Building and running Spring Cloud-based microservices on AWS ECSJoris Kuipers
 
Creating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with ReactCreating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with Reactpeychevi
 
JIRA REST Client for Python - Atlassian Summit 2012
JIRA REST Client for Python - Atlassian Summit 2012JIRA REST Client for Python - Atlassian Summit 2012
JIRA REST Client for Python - Atlassian Summit 2012Atlassian
 
Infrastructure as Code 삽질기
Infrastructure as Code 삽질기Infrastructure as Code 삽질기
Infrastructure as Code 삽질기Changwan Jun
 
How to Win on the Apple Watch
How to Win on the Apple WatchHow to Win on the Apple Watch
How to Win on the Apple WatchNatasha Murashev
 
ChefConf 2014 - AWS OpsWorks Under The Hood
ChefConf 2014 - AWS OpsWorks Under The HoodChefConf 2014 - AWS OpsWorks Under The Hood
ChefConf 2014 - AWS OpsWorks Under The HoodJonathan Weiss
 
Spring Boot Actuator
Spring Boot ActuatorSpring Boot Actuator
Spring Boot ActuatorRowell Belen
 
Lecture 11 Firebase overview
Lecture 11 Firebase overviewLecture 11 Firebase overview
Lecture 11 Firebase overviewMaksym Davydov
 
Modern Web Developement
Modern Web DevelopementModern Web Developement
Modern Web Developementpeychevi
 
Kubernetes Service Catalog & Open Service Broker for Azure
Kubernetes Service Catalog & Open Service Broker for AzureKubernetes Service Catalog & Open Service Broker for Azure
Kubernetes Service Catalog & Open Service Broker for AzureJulien Corioland
 
Serverless Apps with Open Whisk
Serverless Apps with Open Whisk Serverless Apps with Open Whisk
Serverless Apps with Open Whisk Dev_Events
 
What Does Kubernetes Look Like?: Performance Monitoring & Visualization with ...
What Does Kubernetes Look Like?: Performance Monitoring & Visualization with ...What Does Kubernetes Look Like?: Performance Monitoring & Visualization with ...
What Does Kubernetes Look Like?: Performance Monitoring & Visualization with ...InfluxData
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API07.pallav
 
Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015Matt Raible
 

What's hot (20)

Building a Serverless company with Node.js, React and the Serverless Framewor...
Building a Serverless company with Node.js, React and the Serverless Framewor...Building a Serverless company with Node.js, React and the Serverless Framewor...
Building a Serverless company with Node.js, React and the Serverless Framewor...
 
Extending Kubernetes with Operators
Extending Kubernetes with OperatorsExtending Kubernetes with Operators
Extending Kubernetes with Operators
 
From Spring Boot 2.2 to Spring Boot 2.3 #jsug
From Spring Boot 2.2 to Spring Boot 2.3 #jsugFrom Spring Boot 2.2 to Spring Boot 2.3 #jsug
From Spring Boot 2.2 to Spring Boot 2.3 #jsug
 
API Days Australia - Automatic Testing of (RESTful) API Documentation
API Days Australia  - Automatic Testing of (RESTful) API DocumentationAPI Days Australia  - Automatic Testing of (RESTful) API Documentation
API Days Australia - Automatic Testing of (RESTful) API Documentation
 
Docker and java
Docker and javaDocker and java
Docker and java
 
OpenWhisk
OpenWhiskOpenWhisk
OpenWhisk
 
Building and running Spring Cloud-based microservices on AWS ECS
Building and running Spring Cloud-based microservices on AWS ECSBuilding and running Spring Cloud-based microservices on AWS ECS
Building and running Spring Cloud-based microservices on AWS ECS
 
Creating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with ReactCreating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with React
 
JIRA REST Client for Python - Atlassian Summit 2012
JIRA REST Client for Python - Atlassian Summit 2012JIRA REST Client for Python - Atlassian Summit 2012
JIRA REST Client for Python - Atlassian Summit 2012
 
Infrastructure as Code 삽질기
Infrastructure as Code 삽질기Infrastructure as Code 삽질기
Infrastructure as Code 삽질기
 
How to Win on the Apple Watch
How to Win on the Apple WatchHow to Win on the Apple Watch
How to Win on the Apple Watch
 
ChefConf 2014 - AWS OpsWorks Under The Hood
ChefConf 2014 - AWS OpsWorks Under The HoodChefConf 2014 - AWS OpsWorks Under The Hood
ChefConf 2014 - AWS OpsWorks Under The Hood
 
Spring Boot Actuator
Spring Boot ActuatorSpring Boot Actuator
Spring Boot Actuator
 
Lecture 11 Firebase overview
Lecture 11 Firebase overviewLecture 11 Firebase overview
Lecture 11 Firebase overview
 
Modern Web Developement
Modern Web DevelopementModern Web Developement
Modern Web Developement
 
Kubernetes Service Catalog & Open Service Broker for Azure
Kubernetes Service Catalog & Open Service Broker for AzureKubernetes Service Catalog & Open Service Broker for Azure
Kubernetes Service Catalog & Open Service Broker for Azure
 
Serverless Apps with Open Whisk
Serverless Apps with Open Whisk Serverless Apps with Open Whisk
Serverless Apps with Open Whisk
 
What Does Kubernetes Look Like?: Performance Monitoring & Visualization with ...
What Does Kubernetes Look Like?: Performance Monitoring & Visualization with ...What Does Kubernetes Look Like?: Performance Monitoring & Visualization with ...
What Does Kubernetes Look Like?: Performance Monitoring & Visualization with ...
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 
Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015
 

Similar to Infracoders VII - Someone is Watching You

Extending kubernetes with CustomResourceDefinitions
Extending kubernetes with CustomResourceDefinitionsExtending kubernetes with CustomResourceDefinitions
Extending kubernetes with CustomResourceDefinitionsStefan Schimanski
 
Meetup - Principles of the kube api and how to extend it
Meetup - Principles of the kube api and how to extend itMeetup - Principles of the kube api and how to extend it
Meetup - Principles of the kube api and how to extend itStefan Schimanski
 
Toyko azure meetup # 1 azure paa s overview
Toyko azure meetup # 1   azure paa s overviewToyko azure meetup # 1   azure paa s overview
Toyko azure meetup # 1 azure paa s overviewTokyo Azure Meetup
 
JDD2015: Kubernetes - Beyond the basics - Paul Bakker
JDD2015: Kubernetes - Beyond the basics - Paul BakkerJDD2015: Kubernetes - Beyond the basics - Paul Bakker
JDD2015: Kubernetes - Beyond the basics - Paul BakkerPROIDEA
 
Context Information Management in IoT enabled smart systems - the basics
Context Information Management in IoT enabled smart systems - the basicsContext Information Management in IoT enabled smart systems - the basics
Context Information Management in IoT enabled smart systems - the basicsFernando Lopez Aguilar
 
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Amazon Web Services
 
Running Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkRunning Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkAmazon Web Services
 
DevOpSec_KubernetesOperatorUsingJava.pdf
DevOpSec_KubernetesOperatorUsingJava.pdfDevOpSec_KubernetesOperatorUsingJava.pdf
DevOpSec_KubernetesOperatorUsingJava.pdfkanedafromparis
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)HungWei Chiu
 
Containerizing your Security Operations Center
Containerizing your Security Operations CenterContainerizing your Security Operations Center
Containerizing your Security Operations CenterJimmy Mesta
 
DevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office HoursDevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office HoursAmazon Web Services
 
Open shift enterprise 3.1 paas on kubernetes
Open shift enterprise 3.1   paas on kubernetesOpen shift enterprise 3.1   paas on kubernetes
Open shift enterprise 3.1 paas on kubernetesSamuel Terburg
 
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADSKNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADSElad Hirsch
 
Itb 2021 - Bulding Quick APIs by Gavin Pickin
Itb 2021 - Bulding Quick APIs by Gavin PickinItb 2021 - Bulding Quick APIs by Gavin Pickin
Itb 2021 - Bulding Quick APIs by Gavin PickinGavin Pickin
 
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017Codemotion
 
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-ServicesNode Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-ServicesChris Bailey
 
Istio Playground
Istio PlaygroundIstio Playground
Istio PlaygroundQAware GmbH
 

Similar to Infracoders VII - Someone is Watching You (20)

Extending kubernetes with CustomResourceDefinitions
Extending kubernetes with CustomResourceDefinitionsExtending kubernetes with CustomResourceDefinitions
Extending kubernetes with CustomResourceDefinitions
 
Meetup - Principles of the kube api and how to extend it
Meetup - Principles of the kube api and how to extend itMeetup - Principles of the kube api and how to extend it
Meetup - Principles of the kube api and how to extend it
 
Toyko azure meetup # 1 azure paa s overview
Toyko azure meetup # 1   azure paa s overviewToyko azure meetup # 1   azure paa s overview
Toyko azure meetup # 1 azure paa s overview
 
JDD2015: Kubernetes - Beyond the basics - Paul Bakker
JDD2015: Kubernetes - Beyond the basics - Paul BakkerJDD2015: Kubernetes - Beyond the basics - Paul Bakker
JDD2015: Kubernetes - Beyond the basics - Paul Bakker
 
Context Information Management in IoT enabled smart systems - the basics
Context Information Management in IoT enabled smart systems - the basicsContext Information Management in IoT enabled smart systems - the basics
Context Information Management in IoT enabled smart systems - the basics
 
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
 
Running Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkRunning Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic Beanstalk
 
DevOpSec_KubernetesOperatorUsingJava.pdf
DevOpSec_KubernetesOperatorUsingJava.pdfDevOpSec_KubernetesOperatorUsingJava.pdf
DevOpSec_KubernetesOperatorUsingJava.pdf
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)
 
Containerizing your Security Operations Center
Containerizing your Security Operations CenterContainerizing your Security Operations Center
Containerizing your Security Operations Center
 
Extending Kubernetes
Extending KubernetesExtending Kubernetes
Extending Kubernetes
 
Deep Dive on Serverless Stack
Deep Dive on Serverless StackDeep Dive on Serverless Stack
Deep Dive on Serverless Stack
 
DevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office HoursDevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office Hours
 
Open shift enterprise 3.1 paas on kubernetes
Open shift enterprise 3.1   paas on kubernetesOpen shift enterprise 3.1   paas on kubernetes
Open shift enterprise 3.1 paas on kubernetes
 
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADSKNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
 
Itb 2021 - Bulding Quick APIs by Gavin Pickin
Itb 2021 - Bulding Quick APIs by Gavin PickinItb 2021 - Bulding Quick APIs by Gavin Pickin
Itb 2021 - Bulding Quick APIs by Gavin Pickin
 
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
 
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-ServicesNode Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
 
Istio Playground
Istio PlaygroundIstio Playground
Istio Playground
 
What is Kubernetes?
What is Kubernetes?What is Kubernetes?
What is Kubernetes?
 

Recently uploaded

Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Product School
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsVlad Stirbu
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2DianaGray10
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Alison B. Lowndes
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesThousandEyes
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform EngineeringJemma Hussein Allen
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»QADay
 

Recently uploaded (20)

Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 

Infracoders VII - Someone is Watching You

  • 1. Someone is 👀 you Kubernetes APIs and Watch Events Explained Oliver Moser
  • 2. The Guy 2 - TU Wien PhD - Braintribe, Inc. - Cloud / Automation / SRE
  • 3. The Talk 3 - Kubernetes APIs - Watch Events - Live Examples
  • 5. Kubernetes API 5 - Resource-based programmable interface for container workloads - HTTP based API - Entrypoint into Kubernetes - Lives in the kube-apiserver
  • 7. Kubernetes Components kube-apiserver kubelet kube-scheduler kube-controller-manager kube-proxy apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - name: nginx image: nginx /api/v1/namespaces/default/pods/nginx
  • 9. Kubernetes Components kube-apiserver kubelet kube-scheduler kube-controller-manager kube-proxy WATCH /apis/apps/v1/watch/replicasets WATCH /api/v1/watch/pods replicaset-controller WATCH /api/v1/watch/namespaces namespace-controller certificate-controller cronjob-controller endpoint-controller node-lifecycle-controller ...
  • 12. Kubernetes API Structure {paths: [ /api, /api/v1, /apis, /apis/, /apis/admission.certmanager.k8s.io, /apis/admission.certmanager.k8s.io/v1beta1, /apis/admissionregistration.k8s.io, /apis/admissionregistration.k8s.io/v1beta1, /apis/apiextensions.k8s.io, /apis/apiextensions.k8s.io/v1beta1, /apis/apiregistration.k8s.io, /apis/apiregistration.k8s.io/v1, /apis/apiregistration.k8s.io/v1beta1, /apis/apps, /apis/apps/v1, /apis/apps/v1beta1, /apis/apps/v1beta2, /apis/authentication.k8s.io, /apis/authentication.k8s.io/v1, … ]} > kubectl proxy & > curl localhost:8001
  • 13. Kubernetes API Structure stolen from: https://blog.openshift.com/kubernetes-deep-dive-api-server-part-1/
  • 14. Kubernetes API Structure { kind: APIGroup, apiVersion: v1, name: apps, versions: [ { groupVersion: apps/v1, version: v1 }, { groupVersion: apps/v1beta2, version: v1beta2 }, { groupVersion: apps/v1beta1, version: v1beta1 } ], preferredVersion: { groupVersion: apps/v1, version: v1 } } > kubectl proxy & > curl localhost:8001/apis/apps
  • 15. Kubernetes API Structure { kind: APIResourceList, apiVersion: v1, groupVersion: apps/v1, resources: [ ... { name: deployments, singularName: , namespaced: true, kind: Deployment, verbs: [ create, delete, get, list, patch, update, watch ], shortNames: [ deploy ], ... } > kubectl proxy & > curl localhost:8001/apis/apps/v1
  • 16. Kubernetes API Structure { kind: DeploymentList, apiVersion: apps/v1, metadata: { selfLink: /apis/apps/v1/deployments, resourceVersion: 242895786 }, items: [ { metadata: { name: phoenix-dev-adx-cartridge, namespace: adx, selfLink: /apis/apps/v1/namespaces/..., uid: 9972a409-ef77-11e9-8904-42010a9c00ae, resourceVersion: 241706486, generation: 1, creationTimestamp: 2019-10-15T18:14:16Z, labels: { app: adx-cartridge, initiative: phoenix, runtime: phoenix-dev, stage: dev, workspace: adx }, ... > kubectl proxy & > curl localhost:8001/apis/apps/v1/deployments
  • 18. - Each Kubernetes Object has a resourceVersion - Used for optimistic locking/ concurrency control Kubernetes Resource Versioning metadata.resourceVersion: 1492311 spec.image: nginx:1.13.2 metadata.resourceVersion: 1492918 spec.image: nginx:1.13.3 apiVersion: v1 kind: Pod metadata: name: nginx namespace: default resourceVersion: 1492311 spec: containers: - image: nginx:1.13.3 name: nginx
  • 20. Watch Events: Incremental State Change Notifications kube-apiserver kube-scheduler GET /api/v1/pods?watch=true metadata.resourceVersion: 1503831 status: { phase: Pending, qosClass: BestEffort } metadata.resourceVersion: 1503832 nodeName: nodeA status: { phase: Pending, conditions: [ { type: PodScheduled, status: True, … } ], } metadata.resourceVersion: 1503851 nodeName: nodeA status: { phase: Running, conditions: [ { type: ContainersReady, status: True, … } ], } MODIFIEDADDED MODIFIED time
  • 21. Watch Events: Type Definition type WatchEvent struct { // The type of the watch event; added, modified, deleted, or error. // +optional Type watch.EventType `json:type,omitempty description:the type of watch event; may be ADDED, MODIFIED, DELETED, BOOKMARK or ERROR` // For added or modified objects, this is the new object; for deleted objects, // it's the state of the object immediately prior to its deletion. // For errors, it's an api.Status. // +optional Object runtime.RawExtension `json:object,omitempty description:the object being watched; will match the type of the resource endpoint or be a Status object if the type is ERROR` }
  • 22. Watch Events: Build up State Type: ModifiedType: Added time Type: Modified Type: Deleted
  • 23. Watch Events: Change Propagation time “delta propagation” “full-state propagation” { "operation": "add", "field": "replicas", "value": 2 } { "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "calico-typha", "namespace": "kube-system" ... }, "spec": { "replicas": 2, ... } } { "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "calico-typha", "namespace": "kube-system" ... }, "spec": { "replicas": 1, ... } } { "operation": "del", "field": "replicas", "value": 1 }
  • 24. Watch Events: Change Propagation time { "operation": "add", "field": "replicas", "value": 2 } { "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "calico-typha", "namespace": "kube-system" ... }, "spec": { "replicas": 2, ... } } { "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "calico-typha", "namespace": "kube-system" ... }, "spec": { "replicas": 1, ... } } { "operation": "del", "field": "replicas", "value": 1 } { "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "calico-typha", "namespace": "kube-system" ... }, "spec": { "replicas": 4, ... } } { "operation": "add", "field": "replicas", "value": 3 } replicas:=4 replicas:=4
  • 25. Watch Events: Change Propagation time { "operation": "add", "field": "replicas", "value": 2 } { "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "calico-typha", "namespace": "kube-system" ... }, "spec": { "replicas": 2, ... } } { "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "calico-typha", "namespace": "kube-system" ... }, "spec": { "replicas": 1, ... } } { "operation": "del", "field": "replicas", "value": 1 } { "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "calico-typha", "namespace": "kube-system" ... }, "spec": { "replicas": 4, ... } } { "operation": "add", "field": "replicas", "value": 3 } lost update! replicas:=5 replicas:=5
  • 28. Watch Events: Edge Triggered vs Level Triggered Signal Rise Signal FallEdge Triggered Level Triggered Signal High Signal Low
  • 29. Watch Events: Edge Triggered vs Level Triggered add 2 replicas remove 1 replica Edge Triggered Level Triggered replicas:=4 replicas:=3 replicas:=2 replicas:=3
  • 30. Watch Events: Edge Triggered vs Level Triggered add 2 replicas remove 1 replica Edge Triggered Level Triggered replicas:=3 replicas:=2 replicas:=1 replicas:=4 replicas:=3 lost update!

Editor's Notes

  1. simple cURL/jq demo simple nodeJS app show OperatorManager UI