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

Docker, Kubernetes, .NET Core

Selçuk Usta
September 28, 2019

Docker, Kubernetes, .NET Core

Presented at .NET Conf 2019 (Microsoft Turkey, Istanbul). It's about how to develop modernized, cloud-native .NET Core applications according to 12 factors.

Selçuk Usta

September 28, 2019
Tweet

More Decks by Selçuk Usta

Other Decks in Programming

Transcript

  1. cloud-enabled applications designed to be locally hosted An application is

    moved to cloud but it’s developed for traditional data centers.
  2. cloud-enabled applications needs reserved resources You may have much more

    unused resources and it's not a cost-effective solution.
  3. According to IDC*, by 2022, 90% of all apps will

    feature microservices architectures that improve the ability to design, debug, update, and leverage third-party code; 35% of all production apps will be cloud-native. (*) https://www.idc.com/getdoc.jsp?containerId=prUS44417618
  4. 3 Configuration management Requires strict separation of config from codebase.

    Use environment variables or secret products of the container orchestration tool.
  5. 3 Configuration management Requires strict separation of config from codebase.

    Use environment variables or secret products of the container orchestration tool. Use Key Vault products such as Azure Key Vault, Hashicorp Vault, etc.
  6. 3 Configuration management Requires strict separation of config from codebase.

    Use environment variables or secret products of the container orchestration tool. Use Key Vault products such as Azure Key Vault, Hashicorp Vault, etc. Should be platform/OS agnostic!
  7. 4 Backing services A backing service is any service the

    app consumes over the network as part of its normal operation.
  8. 4 Backing services A backing service is any service the

    app consumes over the network as part of its normal operation. Application should access to backing services via URL and/or credentials stored in the config.
  9. 4 Backing services A backing service is any service the

    app consumes over the network as part of its normal operation. Application should access to backing services via URL and/or credentials stored in the config. Use local disk!
  10. 4 Backing services A backing service is any service the

    app consumes over the network as part of its normal operation. Application should access to backing services via URL and/or credentials stored in the config. Attach the resource to the executable! Use local disk!
  11. 5 Build, Release, Run Strictly separate all stages. Create immutable

    images when you’re in BUILD stage. Create execution environment (set environment variables, check backing services, etc.) when you’re in RELEASE stage.
  12. 5 Build, Release, Run Strictly separate all stages. Create immutable

    images when you’re in BUILD stage. Create execution environment (set environment variables, check backing services, etc.) when you’re in RELEASE stage. Run the container without any changes in the environment when you’re in RUN stage.
  13. 6 Execute the app as one or more stateless processes

    Use memory cache! Save any physical files in the environment!
  14. 6 Execute the app as one or more stateless processes

    Use memory cache! Save any physical files in the environment! Use sticky session!
  15. 6 Execute the app as one or more stateless processes

    Use memory cache! Save any physical files in the environment! Use sticky session! Containers are ephemeral. They're built, they're released, they're deployed and they're destroyed!
  16. 7 Export services via port binding The application should be

    completely self-contained and should not dependence out to any webserver to get the request.
  17. Export services via port binding The application should be completely

    self-contained and should not dependence out to any webserver to get the request. The exposed port should be stored on the environment. 7
  18. Export services via port binding The application should be completely

    self-contained and should not dependence out to any webserver to get the request. The exposed port should be stored on the environment. The exposed port should be documented absolutely and clearly (TCP/UDP). 7
  19. 8 Scale out via the process model The application should

    never daemonize (work as a background process)!
  20. Scale out via the process model The application should never

    daemonize (work as a background process)! Use process manager such as systemd, supervisord, etc. 8
  21. Scale out via the process model The application should never

    daemonize (work as a background process)! Use process manager such as systemd, supervisord, etc. Horizontally scaling by adding new instance. 8
  22. Scale out via the process model .NET Core 3.0 -

    Run the application as a worker 8
  23. Disposability Keep minimum startup and shutdown time. This facilitates fast

    elastic scaling, rapid deployment of code or config changes. 9
  24. Disposability Keep minimum startup and shutdown time. This facilitates fast

    elastic scaling, rapid deployment of code or config changes. Use IApplicationLifetime interface for graceful shutdown. 9
  25. 10 Dev/Prod Parity The application should consume the same backing

    services in all environments. The same topology should be used in all environments.
  26. 10 Dev/Prod Parity The application should consume the same backing

    services in all environments. The same topology should be used in all environments. The same products should be used for monitoring, logging and tracing in all environments.
  27. 12 Admin processes Admin management tasks should be run in

    the same environment and against the same codebase and configuration as the web/worker application.
  28. 12 Admin processes Admin management tasks should be run in

    the same environment and against the same codebase and configuration as the web/worker application. registry.hub.docker.com/selcukusta/openhack-core-migration:1.0.0 registry.hub.docker.com/selcukusta/openhack-core-seed:1.0.0