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

Kubernetes with Laravel

Kubernetes with Laravel

27023728a22ac6d6a38342c1c1b2cb6e?s=128

Bobby Bouwmann

December 11, 2019
Tweet

Transcript

  1. Kubernetes with Laravel Kubernetes with Laravel

  2. @bobbybouwmann Kubernetes with Laravel

  3. Kubernetes with Laravel

  4. Kubernetes with Laravel

  5. Agenda • What is kubernetes • Laravel with Kubernetes •

    Kubernetes vs Larvel Vapor Kubernetes with Laravel
  6. What is kubernetes? • Orchestra*on pla0orm for containers • Is

    compatable with Docker • Manages deployments and scaling Kubernetes with Laravel
  7. Kubernetes with Laravel

  8. kubectl get pods -o wide NAME READY STATUS AGE IP

    NODE horizon-794474c567-5mxwm 1/1 Running 8d 172.31.17.141 server01.eu-central-1 app-57c65f4d5b-9jbjc 1/1 Running 8d 172.31.21.72 server01.eu-central-1 app-57c65f4d5b-hlz25 1/1 Running 8d 172.31.9.186 server02.eu-central-1 app-57c65f4d5b-tzbb8 1/1 Running 8d 172.31.26.106 server02.eu-central-1 Kubernetes with Laravel
  9. NAME READY STATUS RESTARTS AGE app-594f6cfd8b-gl84s 1/1 Running 0 3d

    app-594f6cfd8b-8623b 1/1 Running 0 3d Kubernetes with Laravel
  10. kubectl apply -f docker/kube/prod.yml NAME READY STATUS RESTARTS AGE app-vb345b238p-4mnz7

    0/1 Terminating 0 3d app-vb345b238p-8623b 1/1 Running 0 3d app-7764bd5f8d-k2k55 0/1 Init:0/1 0 7s Kubernetes with Laravel
  11. NAME READY STATUS RESTARTS AGE app-594f6cfd8b-gl84s 1/1 Running 0 3d

    app-7764bd5f8d-k2k55 0/1 Init:0/1 0 7s Kubernetes with Laravel
  12. NAME READY STATUS RESTARTS AGE app-7764bd5f8d-k2k55 1/1 Running 0 27s

    app-7764bd5f8d-39dd7 1/1 Running 0 3s Kubernetes with Laravel
  13. NAME READY STATUS RESTARTS AGE app-7764bd5f8d-gl84s 1/1 Running 0 3d

    app-59b6f55476-nx65z 0/1 CrashLoopBackOff 4 35s Kubernetes with Laravel
  14. NAME READY STATUS RESTARTS AGE cron-594f6cfd8b-5j46r 0/1 ContainerCreating 0 1s

    app-7764bd5f8d-gl84s 1/1 Running 0 2d app-7764bd5f8d-j234j 1/1 Running 0 2d Kubernetes with Laravel
  15. NAME READY STATUS RESTARTS AGE cron-594f6cfd8b-5j46r 0/1 Completed 0 12s

    app-7764bd5f8d-gl84s 1/1 Running 0 2d app-7764bd5f8d-j234j 1/1 Running 0 2d Kubernetes with Laravel
  16. Laravel with Kubernetes Kubernetes with Laravel

  17. Storage • Database • Storage • Logging • Excep3on Logging

    • Sessions • Queues Kubernetes with Laravel
  18. Database // .env DB_CONNECTION=mysql DB_HOST=prod.hbwehrkblh.eu-central-1.rds.amazonaws.com DB_PORT=3306 DB_DATABASE=app DB_USERNAME=app DB_PASSWORD=123KDjh1233DH*(gh2{34jk]h23\h4) Kubernetes

    with Laravel
  19. Storage // config/filesystems.php 'disks' => [ 's3' => [ 'driver'

    => 's3', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), 'url' => env('AWS_URL'), ], ], Kubernetes with Laravel
  20. Logging // config/logging.php 'channnels' => [ 'papertrail' => [ 'driver'

    => 'monolog', 'level' => 'debug', 'handler' => SyslogUdpHandler::class, 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), ], ], ], Kubernetes with Laravel
  21. // config/logging.php 'channels' => [ 'stderr' => [ 'driver' =>

    'monolog', 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), 'with' => [ 'stream' => 'php://stderr', ], ], ], Kubernetes with Laravel
  22. Excep&on logging // config/logging.php [ 'default' => env('LOG_CHANNEL', 'stack'), 'channels'

    => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['daily', 'flare'], 'ignore_exceptions' => false, ], ], ] Kubernetes with Laravel
  23. Kubernetes with Laravel

  24. Excep&on logging // .env SENTRY_LARAVEL_DSN=https://d42dhg9bf3d4b10jhef828a866ac44834@sentry.io/8499832 Kubernetes with Laravel

  25. Kubernetes with Laravel

  26. Sessions // .env SESSION_DRIVER=database SESSION_LIFETIME=120 Kubernetes with Laravel

  27. Queues QUEUE_CONNECTION=sync REDIS_HOST=redis REDIS_PASSWORD=null REDIS_PORT=6379 Kubernetes with Laravel

  28. Queues QUEUE_CONNECTION=sync REDIS_HOST=redis REDIS_PASSWORD=null REDIS_PORT=6379 Kubernetes with Laravel

  29. Kubernetes with Laravel

  30. Golden rules • Persistent storage is always external • Container

    monitoring • Keep containers small Kubernetes with Laravel
  31. Kubernetes vs Laravel Vapor Kubernetes with Laravel

  32. Kubernetes with Laravel

  33. Kubernetes with Laravel

  34. h"p:/ /bit.ly/laravel-giveaway Kubernetes with Laravel

  35. Kubernetes with Laravel - Any ques*ons? - Kubernetes with Laravel