Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SLAC18: PHP in the Container Cloud

SLAC18: PHP in the Container Cloud

License: CC BY-SA

Slides of my talk at the Secure Linux Administration Conference in Berlin at May 7th, 2018.

Martin Helmich

May 07, 2018
Tweet

More Decks by Martin Helmich

Other Decks in Programming

Transcript

  1. PHP IN THE CONTAINER CLOUD MARTIN HELMICH MITTWALD CM SERVICE

    GmbH & Co. KG SLAC2018, BERLIN MAY 7th, 2018
  2. This work is licensed under a Creative Commons Attribution- ShareAlike

    4.0 International License. http://creativecommons.org/licenses/by-sa/4.0/
  3. MARTIN HELMICH SOFTWARE & SYSTEMS ARCHITECT @ MITTWALD CM SERVICE

    LECTURER @ PHWT VECHTA http://stackoverflow.com/story/martinhelmich https://github.com/martin-helmich https://www.martin-helmich.de
  4. None
  5. None
  6. None
  7. CC-BY-SA, Atomic Taco https://www.flickr.com/photos/atomictaco/25016033688

  8. None
  9. catdoc pdftotext

  10. catdoc pdftotext

  11. WHY DOCKER?

  12. WHY DOCKER? - EFFICIENCY - STANDARDIZED - STRONG COMMUNITY -

    DEVOPS SPIRIT & AUTOMATION
  13. None
  14. None
  15. KUBERNETES

  16. KUBERNETES - KUBER-WHAT!? - „GOOGLE SCALE“ - DEVOPS‘ DREAM

  17. None
  18. POD - 1(ISH) CONTAINER - SHORT-LIVED - DISPOSABLE KUBERNETES CORE

    CONCEPTS
  19. apiVersion: v1 kind: Pod metadata: name: some-pod spec: containers: -

    name: web image: nginx ports: - containerPort: 80
  20. $ kubectl apply -f pod.yaml pod "some-pod" created $ kubectl

    get pods NAME READY STATUS some-pod 1/1 Running apiVersion: v1 kind: Pod metadata: name: some-pod spec: containers: - name: web image: nginx ports: - containerPort: 80
  21. KUBERNETES CORE CONCEPTS POD - 1(ISH) CONTAINER - SHORT-LIVED -

    DISPOSABLE REPLICA SET - MANAGES MULTIPLE PODS DEPLOYMENT - MANAGES MULTIPLE VERSIONS OF REPLICA SETS - ROLLING UPDATES/ ROLLBACKS SERVICE - STABLE DNS/ IP ADDRESS
  22. SPACES CONTAINER ARCHITECTURE DATABASE PODS (STATEFUL SET) CACHING PODS (REDIS;

    STATEFUL SET) APPLICATION PODS (CUSTOM IMAGE; DEPLOYMENT) LOGGING POD (NXLOG; DEPLOYMENT) MANAGEMENT (SALTSTACK; DEPLOYMENT) NETWORK FILESYSTEM (PERSISTENT VOLUME)
  23. $ kubectl scale deployment my-app --replicas=32 deployment "my-app" scaled $

    kubectl get deployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE my-app 32 32 32 15 30m $ kubectl get pods NAME READY STATUS RESTARTS AGE my-app-2035384211-7ci7o 1/1 Running 0 18s my-app-2035384211-kzszj 1/1 Running 0 18s my-app-2035384211-qqcnn 1/1 Running 0 18s …
  24. $ kubectl autoscale deployment my-app \ --min=4 --max=128 --cpu-percent=80 deployment

    "my-app" autoscaled
  25. BENEFITS CUSTOMER + PROVIDER • EFFICIENT RESOURCE UTILIZATION (NO OVERPROVISIONING)

    • FAST SCALE-UP & SCALE-DOWN • „ZERO-CONF“
  26. CHALLENGES

  27. PHP ON SCALE SLAC 2017: „PHP ON SCALE“ https://speakerdeck.com/martinhelmich/slac17-php-on-scale

  28. SHARED FILESYSTEM /fileadmin /typo3conf /typo3temp /uploads SOLUTION #1: CONFIGURE APPLICATION

    TO USE OBJECT STORE (S3, CEPH, …) AND CENTRALIZED CACHES SOLUTION #2: USE NETWORK FILESYSTEM (NFS, GLUSTER, CEPHFS, …)
  29. SCALING PHP APPS IS EASY… SCALING DATABASES IS NOT

  30. SCALABLE CACHING LAYER (RELATIVELY) FIXED-SCALE DATABASE

  31. DATABASE CLUSTER ORCHESTRATED BY VITESS VTGATE

  32. SIZING & SCHEDULING

  33. 8 CPUS 64 GiB RAM KUBERNETES SCHEDULING THE NODE THE

    PODS REQUESTS LIMIT .5 CPU / 1 CPU 128 MiB/ 256 MiB LIMITS = REQUESTS -> GUARANTEED POD LIMITS > REQUESTS -> OVERCOMITTMENT SCHEDULING POD REQUESTS MUST FIT NODE POD LIMITS MAY BE LARGER THAN NODE CAPACITY LIMITS > CAPACITY -> OK
  34. KUBERNETES SETUP STORAGE ARCHITECTURE NETWORKING/ INGRESS APPLICATION ARCHITECTURE APPLICATION LIFECYCLE

    THE KUBERNETES ICEBERG
  35. QUESTIONS?

  36. None