k8s
Apache MesOS: Distributed resource management tool, used in conjunction with Marathon — Twitter switched to K8S
Docker swarm, docker’s own container scheduling tool — Ali Cloud excluded swarm
Kubernetes — Derived from Borg, Google’s open source container orchestration tool
K8s characteristics
Lightweight: consumes less resources
Elastic scaling
Open source
Load balancing: IPVS
The function of k8s
self-healing
Elastic scaling
Service discovery
Load balancing
Version back
Store layout
K8s is essentially a set of clusters on which specific programs can be run to manage nodes. Its purpose is to automate resource management.
K8s architecture
K8s components
The K8S cluster is mainly composed of control nodes and working nodes. Different components are installed on each node.
1. The master control plane is responsible for cluster decision-making:
API Server An access point for all services. It accepts commands entered by users and provides authentication, authorization, API registration, and discovery mechanisms
Controller Manager: Maintains cluster status, such as program deployment, fault detection, automatic expansion, rolling updates, etc.
Scheduler is responsible for scheduling cluster resources and scheduling PODS to corresponding nodes according to predetermined policies.
ETCD: key-value database that stores all the important information (persistent) of the K8S cluster. Provides information about resource objects in a storage cluster.
2. The data plane of the Node cluster is responsible for providing the running environment for containers
Kubelet: Responsible for the container life cycle, i.e. creating, updating and destroying containers by controlling docker
Kube-proxy: service discovery and load balancing within a cluster
Docker: Responsible for various operations on nodes
Important plug-ins:
Core DNS: Creates a domain name IP mapping resolution for the SVC in the cluster
DASHBOARD: provide a B, S structure access system for K8S cluster
INGRESS Controller: Officially only 4 levels of agents are available. INGRESS can implement 7 levels of agents
Fedetation: Provides a unified management function for multiple K8S across cluster centers
Prometheus: provides monitoring capability for the K8S cluster
ELK: provides a unified K8s cluster log analysis and intervention platform
It is best to have an odd number of ha cluster replicas >3
POD type:
The POD managed by the controller
POD that is not managed by the controller, autonomous POD
Types of PODS:
ReplicationController (RC) : Used to ensure that the number of copies of container applications is always at the user-defined number. RS (ReplicationSet) is recommended for the latest version.
ReplicationSet: Same as RC and supports integrated selectors. Stateless design.
Deployment: Use Deployment to manage RS automatically. Stateless design.
Horizon Podautoscale (HPA) : only applicable to Deployment and Replicaset. In V1, it supports scaling based on POD CPU utilization. In VLalpha, it supports scaling based on memory and user-defined metric
StatefulSet: To solve stateful service problems. Application scenario: Stable persistent storage, stable network flags, orderly deployment, and orderly shrinkage.
DaemonSet: Make sure all (or some) nodes have a POD copy running. When nodes are added to the cluster, a POD is added to them. When nodes are removed from the cluster, these pods are also reclaimed. Deleting DaemonSet will delete all the pods it created.
Job: Ensures that one or more pods of the processing task are successfully completed
CronJob: indicates a time-based job
Network communication mode:
Between containers within the same POD: Lo
Communication between pods: Overlay Network
Communication between POD and Service: IPTables rules for each node
Network solution: Flannel
K8s installation
kubewdm
centos7
Koolshare
harbor