Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Openshift
Maciej Żarczyński
Agenda
◎ Wprowadzenie◎ Wybrane obiekty API i ich właściwości◎ Demo
Optymalizacja zasobów
Aspekt sprzętowy
Klasyczna wirtualizacja (Xen, VMWare, KVM, etc.)
Hypervisor
Kernel
App1
Kernel
App2
Kernel
App3
Kernel
App4
Konteneryzacja (Docker)
Kernel
App1
App3
App2
App4
App5
App6
App7
App8
App9
Źródło: https://kubernetes.io
Optymalizacja zasobów
Aspekt ludzki / czasowy
Stara szkoła
Dev Aplikacja
Dokumentacja
Ops
Deployment
Parametry
Zrównoleglenie procesu /rozdzielenie ról
Ops
OpenshiftDev Aplikacja
obiekty API
Parametry
CI/CD/CDw firmach jest
jak seks w liceum
PaaS
Źródło: https://kubernetes.io
Źródło: https://blog.openshift.com/building-kubernetes-bringing-google-scale-container-orchestration-to-the-enterprise/
Źródło: https://www.cncf.io/blog/2016/08/23/deploying-1000-nodes-of-openshift-on-the-cncf-cluster-part-1/
Obiekty API
ProjectNamespace
Users
Quota
Limit ranges
ImageStreamReprezentacja zbioru
image-y dockera
isImage
Promocja
Trigger
isTag
Import
DeploymentConfig
Pod
ReplicationController
PodInstancja aplikacji
1+ kontenerów
Efemeryczny
ReadinessProbeLimit
(CPU, RAM)
Service Account
LivenessProbe
Pod
apiVersion: v1kind: Podmetadata: name: jug-app-pod labels: app: jugspec: containers: - name: jug-app image: 172.30.1.1:5000/dev/jug@sha256:7123433f5deb3451e5c3898f6fe… ports: - containerPort: 8080 protocol: TCP
ReplicationController
Pilnowanie zadanej liczby Pod-ów (replik)
“Zatrzaśnięta” wersja obrazu aplikacji
( @sha256 )
ReplicationController
apiVersion: v1kind: ReplicationControllermetadata: labels: app: jug name: jug-8spec: replicas: 4 selector: app: jug template: metadata: labels: app: jug spec: containers: <DEFINICJA POD-a>
DeploymentConfig
Trigger
Wersjonowanie aplikacji
Strategie Rolling update
Recreate
Custom
Hook
DeploymentConfig - strategia: Recreate
Pod Pod
rc-1replicas: 2
rc-2replicas: 0
DeploymentConfig - strategia: Recreate
rc-1replicas: 0
rc-2replicas: 0
DeploymentConfig - strategia: Recreate
rc-1replicas: 0
Pod Pod
rc-2replicas: 2
DeploymentConfig - strategia: Rolling
Pod Pod
rc-1replicas: 2
rc-2replicas: 0
DeploymentConfig - strategia: Rolling
Pod Pod
rc-1replicas: 2
rc-2replicas: 1
Pod
DeploymentConfig - strategia: Rolling
Pod
rc-1replicas: 1
rc-2replicas: 1
Pod
DeploymentConfig - strategia: Rolling
Pod
rc-1replicas: 1
Pod Pod
rc-2replicas: 2
DeploymentConfig - strategia: Rolling
rc-1replicas: 0
Pod Pod
rc-2replicas: 2
BuildConfigTrigger
Wytwarza image do Imagestream-a
Strategie S2I
Pipeline
Custom
Docker
Dane wejściowe
Git
Dockerfile
Binary
Image
ServiceVirtual IP
GrupowaniePod-ów
Rodzaje Load Balancer
DNSClusterIPNodeport
LoadBalancer
Endpoint ServiceDiscovery
Env
Service
apiVersion: v1kind: Servicemetadata: labels: app: jug name: jugspec: ports: - name: czesiek port: 8080 protocol: TCP targetPort: 8080 selector: app: jug sessionAffinity: None type: ClusterIP
Label / Selector
Service
selector: app: jug
Pod-1
labels: app: jug
Pod-2
labels: app: jug
Service Discovery
Servicename: jug
Project name: dev
DNS (wewnątrz klastra):jug.dev.svc
ENV: JUG_PORT_8080_TCP_ADDR=172.30.241.153JUG_PORT_8080_TCP=tcp://172.30.241.153:8080JUG_PORT=tcp://172.30.241.153:8080JUG_SERVICE_HOST=172.30.241.153JUG_SERVICE_PORT=8080JUG_PORT_8080_TCP_PORT=8080JUG_PORT_8080_TCP_PROTO=tcpJUG_SERVICE_PORT_CZESIEK=8080
Servicetype: ClusterIPname: db
Servicetype: Endpointname: db
Servicetype: ClusterIPname: db
Proj
ect:
dev
Proj
ect:
sta
ge
Proj
ect:
pro
d
Pod
jdbc:mysql://db:3306
Pod
jdbc:mysql://db:3306
Pod
jdbc:mysql://db:3306
DNS - właściwość konwencji nazw
Route HAProxy
SSLLoad Balancer L7 (HTTP)
Mapowanie publicznych URL-ina Service
Testy A/B
Route
apiVersion: v1kind: Routemetadata: labels: app: jug name: jugspec: host: jug-dev.192.168.99.100.nip.io port: targetPort: czesiek to: kind: Service name: jug weight: 100 wildcardPolicy: None
Servicename: jug
PodIP:10.1.0.4
PodIP:10.2.0.47
Routeto: name: jug
HA
Pro
xy
Demo