Docker, Containers, and Cloud-Native Architecture: A Comprehensive Guide
Docker and Containers
Docker Container: A lightweight, standalone, and executable software package that includes everything needed to run a piece of software: code, runtime, system tools, libraries, and settings.
Docker Image: A read-only template used to create Docker Containers. Images contain the application code and dependencies, system libraries, tools, and settings.
Docker Volumes: Storage mechanisms for persisting data generated and used by Docker Containers. Volumes are managed by Docker and can be shared among containers.
Bind Mounts: A way to map directories on the host machine to directories in a Docker Container. Unlike Docker Volumes, bind mounts have a direct relationship with the host filesystem.
Docker Compose: A tool for defining and running multi-Docker Container Docker applications using a docker-compose.yml file. It simplifies managing applications with multiple interconnected services.
Docker Network: Mechanisms for enabling communication between Docker Containers, either on the same host or across different hosts. Docker provides several network drivers such as bridge, overlay, and host.
Cloud-Native Architecture
Polyglot: The practice of using multiple programming languages, frameworks, or tools within a single project or across projects to take advantage of the strengths of each technology.
Environment: The set of conditions and configurations under which software applications are developed, tested, and deployed. Examples include development, testing, staging, and production environments.
Containerized Application: Applications that are packaged into containers for consistent deployment and execution across various environments.
REST: 1.Uniform interface (resource identification, manipulation of resources through representations, self-describing messages, hypermedia as the engine of application (HATEOAS)), 2.Client-server, 3. Statelessness, 4. Cacheability, 5. Layered system (The system can be composed of hierarchical layers, with each component seeing only the next layer with which it interacts)
Richardson’s Maturity Model: Level 0: The Swamp of POX (single URI, only POSTs, RPC POX & SOAP), Level 1: Resources (individual URIs, POSTs), Level 3: HTTP verbs (for further specializing resources and separation, Level 4: Hypermedia controls (introducing hypermedia elements into the response messages of resources (HATEOAS)).
Idempotents: An operation that produces the same result no matter how many times it is performed. In REST, HTTP methods like GET, PUT, and DELETE are idempotent.
CAP Theorem: A principle that states it is impossible for a distributed data store to simultaneously provide more than two out of three guarantees: Consistency, Availability, and Partition Tolerance.
Conway’s Law: Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization’s communication structure.
12-Factor: Codebase (version control system), Dependencies (explicitly declare and isolate), Configuration, Supporting services, (Build, release, run,) Processes (run the app as one or more processes), Port binding, Concurrency (scale the process model), Disposability (start fast and stop cleanly), Dev-prod parity, Logs, Admin processes, Monolithic: A software architecture in which all components of an application are packaged and deployed together as a single unit.
Service-Oriented Architecture: An architectural pattern where applications are composed of discrete services that communicate over a network, each responsible for a specific business function.
Microservices: An architectural style that structures an application as a collection of small, independently deployable services, each running in its own process and communicating via lightweight mechanisms like HTTP.
Serverless: A cloud computing execution model where the cloud provider dynamically manages the allocation and provisioning of servers. Users write functions that are executed without needing to manage infrastructure.
FaaS: A type of serverless computing where users deploy individual functions rather than entire applications, with the cloud provider handling the execution.
Cloud-Native: An approach to building and running applications that fully exploit the advantages of the cloud computing delivery model. This involves using microservices, containers, CI/CD pipelines, and DevOps practices.
Resilience: The ability of a system to handle and recover from failures gracefully without significant disruption of service.
Fallacies of Distributed Computing: The Network is reliable, Latency is ZERO, Bandwidth is infinite, The network is Secure, Topology doesn’t change, only one administrator, Transport costs, The network is homogeneous
Distributed Systems
Distributed Systems: Systems where components located on networked computers communicate and coordinate their actions by passing messages to achieve a common goal. Typical Problems: Challenges such as network latency, partitioning, consistency, data replication, and fault tolerance.
Resilience Patterns: Retry: Automatically retrying failed operations, Fallback: Providing an alternative response when a service fails, Timeout: Limiting the time spent waiting for a response from a service, Load Balancer: Distributing incoming network traffic across multiple servers, Circuit Breaker: Temporarily blocking requests to a failing service to prevent overload, Monitoring: Continuously observing system performance and health
Kubernetes
Kubernetes Cluster: Kubernetes is an open-source container orchestration software that allows you to manage, coordinate, and schedule containers at scale. Kubernetes places containers into Pods and runs them on Nodes. A Kubernetes cluster has at least one master node that runs a container pod and a control plane that manages the cluster. When you deploy Kubernetes, you are essentially running a Kubernetes cluster.
Control Plane: The component of Kubernetes responsible for managing the state of the cluster, including the API server, scheduler, controller manager, and etcd.
Worker Nodes: Nodes in a Kubernetes cluster that run containerized applications. They host the Pods and provide the runtime environments.
Pod: The smallest deployable units in Kubernetes, representing a single instance of a running process in a cluster, which can contain one or more containers.
Deployments: Kubernetes objects that manage the deployment and scaling of a set of identical Pods. They ensure a specified number of Pods are running and update them as needed.
Service: Kubernetes resources that provide a stable IP address and DNS name to access a set of Pods, enabling communication within the cluster.
Desired State Management: The process by which Kubernetes continuously monitors and maintains the desired state of the system as specified by the user, ensuring the actual state matches the declared state.
