0% found this document useful (0 votes)
37 views

6 Getting Started Kubernetes m6 Slides

This document discusses Kubernetes services, which provide a reliable endpoint for pods within a Kubernetes cluster. Services define rules for accessing pods through DNS names, IP addresses, and ports. They can be used to expose pods to both internal and external clients. Services support different types including ClusterIP, NodePort, and LoadBalancer, with LoadBalancer integrating with external cloud-based load balancers. The document also provides examples of using services to update applications in a production environment.

Uploaded by

andreiionita
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

6 Getting Started Kubernetes m6 Slides

This document discusses Kubernetes services, which provide a reliable endpoint for pods within a Kubernetes cluster. Services define rules for accessing pods through DNS names, IP addresses, and ports. They can be used to expose pods to both internal and external clients. Services support different types including ClusterIP, NodePort, and LoadBalancer, with LoadBalancer integrating with external cloud-based load balancers. The document also provides examples of using services to update applications in a production environment.

Uploaded by

andreiionita
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Kubernetes Services

Nigel Poulton

@nigelpoulton www.nigelpoulton.com
• The theory of Services

• Create a Service the iterative way

• Create a Service the declarative way

• Real-world application

• Recap
Kubernetes Services
The Theory

$ kubectl get pods


NAME READY STATUS RESTARTS AGE
hello-rc-1qch1 1/1 Running 0 8d
hello-rc-39q0s 1/1 Running 0 8d
hello-rc-3fr7t 1/1 Running 0 8d
hello-rc-5qzpl 1/1 Running 0 8d

Kubernetes Services
The Theory

$ kubectl get pods


NAME READY STATUS RESTARTS AGE
hello-rc-1qch1 1/1 Running 0 8d
hello-rc-39q0s 1/1 Running 0 8d
hello-rc-3fr7t 1/1 Running 0 8d
hello-rc-5qzpl 1/1 Running 0 8d

Q
. How do we access our app?
• From outside the cluster
• From inside the cluster
Q
. How do we access our app?
• From outside the cluster
• From inside the cluster
Services:
REST objects in the K8s API
Abstractions
Client

Service
?
IP = reliable
DNS = reliable
Port = reliable

Pod Pod Pod Pod

Replication Controller
Client

Service
IP = reliable
DNS = reliable
Port = reliable

Pod Pod Pod Pod Pod

Replication Controller
Client

Service
IP = reliable
DNS = reliable
Port = reliable

Pod Pod Pod Pod

Replication Controller
Client

Service
IP = reliable
DNS = reliable
Port = reliable

Pod Pod Pod Pod

Replication Controller
Service
IP = 10.0.0.50
DNS = myservice
Port = 30050

Pod Pod Pod Pod


Service
IP = 10.0.0.50
DNS = myservice
Port = 30050

:30050 :30050 :30050 :30050


Pod Pod Pod Pod
Node Node Node Node

Linux Linux Linux Linux


Endpoint Service
Pod1 IP, Pod2 IP, Pod3 IP, IP = 10.0.0.50
Pod4 IP…. DNS = myservice
Port = 30050

:30050 :30050 :30050 :30050


Pod Pod Pod Pod Pod Pod Pod Pod
Node Node Node Node

Linux Linux Linux Linux


Service

Label selector:
zone=prod version=v1

Pod Pod Pod


zone=prod zone=prod zone=prod

version=v1 version=v1 version=v1


Service

Label selector:
zone=prod version=v1

Pod Pod Pod


zone=prod zone=prod zone=prod

version=v1 version=v1 version=v1


Service Discovery
• DNS based (best)

• Environment variables
ServiceType:
ClusterIP: Stable internal cluster IP

NodePort: Exposes the app outside of the


cluster by adding a cluster-wide port on
top of ClusterIP
LoadBalancer: Integrates NodePort with
cloud-based load balancers
Kubernetes Services
In the real world
Kubernetes Services
Updating
In theBusiness
real world Apps
Service app=biz1

zone=prod

pcidss=yes

Pod Pod
app=biz1 app=biz1

zone=prod zone=prod

ver=17.06.02 ver=17.06.02

Replication Controller
Service app=biz1

zone=prod

Pod Pod
Pod
Pod Pod
app=biz1 app=biz1
app=biz1 app=biz1

zone=prod zone=prod
zone=prod zone=prod

ver=17.06.02 ver=17.06.02
ver=17.06.03 ver=17.06.03

Replication ControllerReplication Controller


Service app=biz1

zone=prod

ver=17.06.03

Pod Pod Pod


Pod Pod
app=biz1 app=biz1 app=biz1 app=biz1

zone=prod zone=prod zone=prod zone=prod

ver=17.06.02 ver=17.06.02 ver=17.06.03 ver=17.06.03

Replication Controller Replication Controller


Service app=biz1

zone=prod

ver=17.06.02

Pod Pod Pod


Pod Pod
app=biz1 app=biz1 app=biz1 app=biz1

zone=prod zone=prod zone=prod zone=prod

ver=17.06.02 ver=17.06.02 ver=17.06.03 ver=17.06.03

Replication Controller Replication Controller


Kubernetes Services Summary
Reliable network Expose Pods to the
endpoint outside world

IP address NodePort
Provides a
DNS name cluster-wide port
Port
LoadBalancer
Integrates with cloud-based
load balancers
Coming up…
Kubernetes Deployments

You might also like