飞天使-k8s知识点27-kubernetes温故知新2-deployment

RC和RS
RC不会使用在生产环境
RS 比RC 多了标签选择器 ,RS 用deployment管理,用于容器编排
无状态应用管理 deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.15.12
        ports:
        - containerPort: 80

deployment 涉及 更新,回滚,根据标签去控制pod,扩容,缩容

有状态应用statefulSet
apiVersion: v1
kind: Service
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  ports:
  - port: 80
    name: web
  clusterIP: None
  selector:
    app: nginx
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: web
spec:
  serviceName: "nginx"
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
          name: web
daemonSet
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app: nginx
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx:1.15.12
        imagePullPolicy: IfNotPresent
        name: nginx

参考资料: 宽哥

相关推荐

  1. 飞天使-k8s知识27-kubernetes温故知新2-deployment

    2024-03-20 12:38:04       42 阅读
  2. 飞天使-k8s知识29-kubernetes安装1.28.0版本

    2024-03-20 12:38:04       26 阅读
  3. 飞天使-k8s知识8-kubernetes资源对象-编写中

    2024-03-20 12:38:04       56 阅读
  4. 飞天使-k8s知识10-kubernetes资源对象3-controller

    2024-03-20 12:38:04       58 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-20 12:38:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-20 12:38:04       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-20 12:38:04       82 阅读
  4. Python语言-面向对象

    2024-03-20 12:38:04       91 阅读

热门阅读

  1. Python网络爬虫的设计与实现研究

    2024-03-20 12:38:04       44 阅读
  2. 获取指定日期金融期货数据

    2024-03-20 12:38:04       37 阅读
  3. react中useContext的用法

    2024-03-20 12:38:04       36 阅读
  4. 分流器电阻的工艺结构原理及选型参数总结

    2024-03-20 12:38:04       44 阅读
  5. 常见的排序算法有哪些?用Python实现一个

    2024-03-20 12:38:04       42 阅读
  6. websocket 中 request-line 中的URI编码问题

    2024-03-20 12:38:04       40 阅读
  7. 【大模型学习记录】db-gpt源码安装问题汇总

    2024-03-20 12:38:04       43 阅读
  8. Android学习进阶

    2024-03-20 12:38:04       42 阅读
  9. docker基础(二)之docker build

    2024-03-20 12:38:04       33 阅读