Vernacular Kubernetes basic concepts

Kubernetes Profile

Popular micro-services framework, making service more and more sophisticated, the service becomes more and more, for the distribution and management had a huge challenge, but Dockerthe birth, giving resource management and micro-control services a good foundation. Containerized can solve various locales deployment, high portability, cross-platform deployment. But Dockerthere is no arrangement for container service so convenient, because Dockerthis deficiency, was born Kubernetes, Kubernetesis a portable, scalable, open-source platform for containerized manage workloads and services, promote declarative configuration and automation.

Bring convenience to those using Kubernetes

  • Rapid deployment of applications
  • It is easy to implement horizontal or vertical scaling telescopic
  • Seamless released a new version of the app
  • Maximize the use of resources
  • Application stop automatically restart

Kubernetes Features

  • Portable: support for public cloud, private cloud, hybrid cloud, multi-cloud (multi-cloud)
  • Scalable: modular, plug-in, then it can mount, may be combined
  • Automation: automatic deployment, automatic restart, automatic replication, automatic retractable / expansion

Why Kubernetes, what can it do?

Container is a good way to package and run the application. In a production environment, you need to manage container to run applications and ensure no downtime. For example, if a container fails, it is necessary to start another container. If the system handle this behavior will not be easier?

This is a rescue method Kubernetes! Kubernetes provides you with a framework for resilient operation of a distributed system. Kubernetes will meet your expansion requirements, failover deployment mode.

Kubernetes offers you:

  • 服务发现和负载均衡: Kubernetes can use the DNS name or IP address of your public container, if the large flow of container, Kubernetes can load balance and distribution of network traffic, making deployment and stability.
  • 存储编排: Kubernetes allows you to automatically mount storage system you choose, such as local storage, public cloud providers.
  • 自动部署和回滚: You can use Kubernetes describe the desired state of the container has been deployed, it can at a controlled rate to change the actual state to the desired state. For example, you can automate Kubernetes to create a new container for your deployment, remove the existing container and all their resources for the new container.
  • 容器资源配额: Kubernetes you need to allow the CPU and memory (RAM) specifies that each container. When the container specified resource requests, Kubernetes can make better decisions to manage container resources.
  • 自我修复: Kubernetes restarts failed container, replace the container, kill does not respond to the health of the user-defined inspection of the vessel, and does not notice until ready to serve it to the client.
  • 密钥与配置管理: Kubernetes allows you to store and manage sensitive information, such as passwords, OAuth tokens and ssh keys. You can deploy and update the key and application configuration, and without exposure to key in a stacked configuration in the case of container without rebuilding the image.
  • 配置文件: Kubernetes can ConfigMap to store configuration.

Kubernetes basic resource definition and understanding

Everything is resources, you can describe everything, anything can manage.

NameSpaces

Namespace, in a Kubernetes cluster namespace can be used to create multiple "virtual cluster" can be completely isolated from the namespace, can in some way make a namespace can access the service to other namespace in the service.

Deployment

Deployment provides a statement defined in formula (Declarative) method Pod and ReplicaSet, to replace previous ReplicationControllerto facilitate the management application. Typical application scenarios include:

  • Pod to create and define Deployment ReplicaSet
  • Rolling upgrade and rollback application
  • Accommodating expansion and contraction
  • Pause and resume Deployment

Service

Kubernetes Service defines such an abstract: logical grouping of a Pod A can access their policy - is commonly referred to 微服务. This group of Pod can be accessed Service is usually achieved by Label Selector.

Ingress

Ingress is the entrance from internal and external access to the cluster Kubernetes cluster services. For example, the official maintained Ingress Nginx. ingress traefik, ingress haproxyAnd so on.

Under

Pod is kubernetes you can create and deploy the smallest and most simple units. Pod represents a process running in the cluster.

Pod encapsulated in a container application (in some cases is several containers), storage, independent network IP, how to manage the operation of container policy options. Pod represents a unit of deployment: kubernetes applied in one example, or may be a combination of a plurality of containers together to share resources.

ConfigMap

ConfigMap API resources used to store key-value pair configuration data, this data can be used in the pods, the controller or the like is used as a system component is stored as configuration data. Although ConfigMap similar with the Secrets, but does not contain sensitive information string ConfigMap more convenient process. Note: alternatives ConfigMaps not a property profile. ConfigMaps just cited as multiple properties files. You can understand it as a Linux system / etc directory, designed to directory to store configuration files.

Secret

Secret configuration solves the problem of sensitive data password, token, key, etc., without the need to expose the sensitive data to the image or Pod Spec. Volume Secret can be used in a manner or environment variables.

Secret There are three types:

  • Service Account : Used to access Kubernetes API, it is automatically created by Kubernetes, and automatically mounts the directory to /run/secrets/kubernetes.io/serviceaccount Pod's;
  • Opaque : Secret base64 encoding format used to store passwords, keys and the like;
  • kubernetes.io/dockerconfigjson : Used to store authentication information of private docker registry.

PV and PVC

For continuously storing data, Pod, the container destroyed, all data will be destroyed, if necessary to retain the data, where it is necessary to use storage volume PV, PVC stated storage volume.

Deployment PVC commonly used in storage for data persistence. Durable storage also need to understand Volume concept.

Volume

The life cycle of the file on the disk container is short, which makes there will be some problems when running important applications in the container. First, when the container crashes, kubelet will restart it, but the container file will be lost - the container with a clean state (mirroring the initial state) restart. Secondly, when the plurality of containers simultaneously run Pod usually need to share files between the containers. Volume abstract Kubernetes of a good solution to these problems.

Labels 和 Selectors

标签And 选择器. For each container used to play the role of labels, then the respective controller matches Selector container, and management. Deployment Service or such as would match the corresponding Pod in this way.

Readme

These are just a few commonly used resources Kubernetes concept and function, specific description can be found Kubernetes official documents .

Reference links

  • https://kubernetes.io/docs/home/
  • https://jimmysong.io/kubernetes-handbook
  • https://www.jianshu.com/p/b5b9041e8d7b

This article from the YP station released!

Published 31 original articles · won praise 11 · views 1405

Guess you like

Origin blog.csdn.net/qq_24794401/article/details/103837165