云原生学习笔记一:什么是云原生?

发布于:2022-08-06 ⋅ 阅读:(388) ⋅ 点赞:(0)

背景

最近公司全面拥抱云原生,对此还是很困惑,究竟什么是云原生?它的作用是什么?解决了哪些问题?我们存储怎么结合云原生?

什么是云原生?

CNCF有官方的定义,Cloud Native Computing Foundation

  • 设计、构造、操作运维的对象是云应用,可以充分利用云计算模型
  • 核心技术:容器、service mesh(服务栅格)、微服务、不变基础架构、declartive API
  • 宗旨:快速、敏捷

一些公司的云原生系统规模

Company

Experience

Netflix

Has 600+ services in production. Deploys 100 times per day.

Uber

Has 1,000+ services in production. Deploys several thousand times each week.

WeChat

Has 3,000+ services in production. Deploys 1,000 times a day.

云原生的5大支柱

  1. 云基础设施是最重要的基础
    1. 传统的基础设施是通过scale-up的方式,用户可能感知server fail
    2. 云原生架构下,都是以微服务的方式,不关系底下的基础设施,微服务fail了,可以切换或者重建新的微服务,用户不感知?
    3. 自动扩展、自恢复、监控能力

现代设计

云原生设计十二因素

Factor

Explanation

1 - Code Base

A single code base for each microservice, stored in its own repository. Tracked with version control, it can deploy to multiple environments (QA, Staging, Production).

2 - Dependencies

Each microservice isolates and packages its own dependencies, embracing changes without impacting the entire system.

3 - Configurations

Configuration information is moved out of the microservice and externalized through a configuration management tool outside of the code. The same deployment can propagate across environments with the correct configuration applied.

4 - Backing Services

Ancillary resources (data stores, caches, message brokers) should be exposed via an addressable URL. Doing so decouples the resource from the application, enabling it to be interchangeable.

5 - Build, Release, Run

Each release must enforce a strict separation across the build, release, and run stages. Each should be tagged with a unique ID and support the ability to roll back. Modern CI/CD systems help fulfill this principle.

6 - Processes

Each microservice should execute in its own process, isolated from other running services. Externalize required state to a backing service such as a distributed cache or data store.

7 - Port Binding

Each microservice should be self-contained with its interfaces and functionality exposed on its own port. Doing so provides isolation from other microservices.

8 - Concurrency

When capacity needs to increase, scale out services horizontally across multiple identical processes (copies) as opposed to scaling-up a single large instance on the most powerful machine available. Develop the application to be concurrent making scaling out in cloud environments seamless.

9 - Disposability

Service instances should be disposable. Favor fast startup to increase scalability opportunities and graceful shutdowns to leave the system in a correct state. Docker containers along with an orchestrator inherently satisfy this requirement.

10 - Dev/Prod Parity

Keep environments across the application lifecycle as similar as possible, avoiding costly shortcuts. Here, the adoption of containers can greatly contribute by promoting the same execution environment.

11 - Logging

Treat logs generated by microservices as event streams. Process them with an event aggregator. Propagate log data to data-mining/log management tools like Azure Monitor or Splunk and eventually to long-term archival.

12 - Admin Processes

Run administrative/management tasks, such as data cleanup or computing analytics, as one-off processes. Use independent tools to invoke these tasks from the production environment, but separately from the application.

微服务

微服务的优点:

  1. 独立性、隔离性
  2. 部署上也可以分隔开

容器

为什么需要容器?

docker是事实标准

  1. 部署十分方便,互相隔离
  2. 更轻量,不需要类似虚机那么多的资源使用

容器编排

kubernetes是事实标准

管理容器的主要任务

Tasks

Explanation

Scheduling

Automatically provision container instances.

Affinity/anti-affinity

Provision containers nearby or far apart from each other, helping availability and performance.

Health monitoring

Automatically detect and correct failures.

Failover

Automatically reprovision a failed instance to a healthy machine.

Scaling

Automatically add or remove a container instance to meet demand.

Networking

Manage a networking overlay for container communication.

Service Discovery

Enable containers to locate each other.

Rolling Upgrades

Coordinate incremental upgrades with zero downtime deployment. Automatically roll back problematic changes

后台服务

比如,数据存储,消息分发,监控,身份认证等后台服务

特点:无状态

自动化

云原生号称快速和敏捷,那它是怎么做到的呢?

最先需要思考的问题是,这些服务怎么部署,资源怎么管理,甚至包含QA等等

里面有个比较有趣的概念,基础设施即代码(IaC)

自动化的基本步骤:

我们可能还只停留在CI阶段,似乎没有CD,这个流程还没有走通

原文:What is Cloud Native? | Microsoft Docs

本文含有隐藏内容,请 开通VIP 后查看

网站公告

今日签到

点亮在社区的每一天
去签到