K8s and Docker — Chapter 1 : Introduction

Giang Trung
3 min readSep 24, 2020
  1. Structure
  • Jenkins build docker image → Docker Registry → K8s download docker image and start.
  • We can use K8s to control service.

2. Introduction

  • K8s is open source for deploying containerized application, scalable, reliable system. Kubernetes is a proven infrastructure for distributed systems that is suitable for cloud-native developers.
  • Help sysadmin who has woken up at 3 a.m. to restart a process. Every developer who pushed code to production only to find that it didn’t run like it did on their laptop

3. Why to use

  • There are many reasons why people come to use containers and container APIs like Kubernetes, but we believe they can all be traced back to one of these benefits:

> Velocity

While your users are always looking for iterative improvement, they are more interested in a highly reliable service. Once upon a time, it was OK for a service to be down for maintenance at midnight every night. But today, all users expect constant uptime, even if the software they are running is changing constantly. Consequently, velocity is measured not in terms of the raw number of features you can ship per hour or day, but rather in terms of the number of things you can ship while maintaining a highly available service.

>>> Immutability : In an immutable system, rather than a series of incremental updates and changes, an entirely new, complete image is built, where the update simply replaces the entire image with the newer image in a single operation. There are no incremental changes. Building a new image rather than modifying an existing one means the old image is still around, and can quickly be used for a rollback if an error occurs.

>>> Declarative Configuration: While imperative commands define actions, declarative configurations define state. To understand these two approaches, consider the task of producing three replicas of a piece of software. With an imperative approach, the configuration would say “run A, run B, and run C.” The corresponding declarative configuration would be “replicas equals three.”

>>> Self-Healing Systems: When it receives a desired state configuration, it does not simply take a set of actions to make the current state match the desired state a single time. It continuously takes actions to ensure that the current state matches the desired state. This means that not only will Kubernetes initialize your system, but it will guard it against any failures or perturbations that might destabilize the system and affect reliability.

> Scaling (of both software and teams)

As your product grows, it’s inevitable that you will need to scale both your software and the teams that develop it. Fortunately, Kubernetes can help with both of these goals. Kubernetes achieves scalability by favoring decoupled architectures

Kubernetes provides numerous abstractions and APIs that make it easier to build these decoupled microservice architectures:

  • Pods, or groups of containers, can group together container images developed by different teams into a single deployable unit.
  • Kubernetes services provide load balancing, naming, and discovery to isolate one microservice from another.
  • Namespaces provide isolation and access control, so that each microservice can control the degree to which other services interact with it.
  • Ingress objects provide an easy-to-use frontend that can combine multiple microservices into a single externalized API surface area

> Abstracting your infrastructure

> Efficiency

Reducing the overall number of machines used in turn drives up the efficiency of each system: since more of the resources (CPU, RAM, etc.) on each individual machine are used, the overall cost of each container becomes much lower.

Kubernetes was built to radically change the way that applications are built and deployed in the cloud

--

--