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

Docker and Kubernetes 101 for developers

Docker and Kubernetes 101 for developers

This talk will introduce containerisation with Docker; how you can use it to make your workflows more predictable and your servers more reliable; and using Kubernetes to spin up your applications in the cloud using nothing but YAML files, with monitoring, logging, scaling and networking all taken care of. We'll be looking at some real-world examples, some tips and tricks, advice on developing on your local machine, and what to look at when deploying to production.

Mohammed Fazalullah

April 03, 2023
Tweet

More Decks by Mohammed Fazalullah

Other Decks in Technology

Transcript

  1. © 2022 Cloud Native Computing Foundation 2 Containers and docker

    A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. 1 https://www.docker.com/resources/what-container Server Operating System Docker Engine App A App B App C App D
  2. © 2022 Cloud Native Computing Foundation 3 Docker architecture Docker

    daemon manages images, containers, networks, and volumes Docker CLI communicates with Docker daemon through a REST API Sample commands: docker build – Build image from Dockerfile docker images – List images on Docker host docker run – Run an image docker ps – List running containers docker stop – Stop a running container Docker daemon / REST API Docker host Container 1 Container 2 Container n Ubuntu image Nginx image Custom image Docker client Docker registry Docker hub
  3. © 2022 Cloud Native Computing Foundation 4 Docker image Read-only

    template Used to launch container Start with base image, additional data, or dependencies added as layers Union file system merges layers into a single image Instructions documented in Dockerfile Kernel Base image Image layer Image layer Image layer References parent image layer
  4. © 2022 Cloud Native Computing Foundation 5 Dockerfile FROM dockerfile/ubuntu

    RUN \ add-apt-repository -y ppa:nginx/stable && \ apt-get update && \ apt-get install -y nginx && \ rm -rf /var/lib/apt/lists/* && \ echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \ chown -R www-data:www-data /var/lib/nginx VOLUME ["/etc/nginx/sites-enabled", "/etc/nginx/conf.d", "/var/log/nginx", "/var/www/html"] WORKDIR /etc/nginx CMD ["nginx"] EXPOSE 80 Pull base image Install NGINX Define mountable directories Define working directory Define default command Expose ports yourimage:1.0.0 9c9e81692ae9 02071fceb21b b35224abf821 fbc63d321d73 8c2e06607696 E7829950cee3
  5. © 2022 Cloud Native Computing Foundation 9 Kubernetes is an

    open source orchestration system that helps deploy and scale your containerized applications
  6. © 2022 Cloud Native Computing Foundation 11 Core Kubernetes Concepts

    One or more containers that run together (same Node & Namespace) are a Pod Pods get scheduled onto Nodes which can be VMs or bare metal In order to run more than one Pod a ReplicaSet scales your Pods out To manage change a Deployment creates a new ReplicaSet with the new version then scales the old one down and the new up.
  7. © 2022 Cloud Native Computing Foundation 15 Next meetup in

    March! Join now for updates https://www.meetup.com/dubai-kubernetes-meetup Reach out to any of us if you want to speak and/or sponsor!