K8S deployment挂载

挂载到emptyDir

挂载在如下目录,此目录是pod所在的node节点主机的目录,此目录下的data即对应容器里的/usr/share/nginx/html,实现目录挂载;图1红框里的号对应docker 的name中的编号,如下俩个图

复制代码
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{"deployment.kubernetes.io/revision":"1"},"creationTimestamp":"2023-05-08T13:55:49Z","generation":1,"labels":{"app":"web"},"name":"web","namespace":"dalong-test-1","resourceVersion":"228450","uid":"359f54a6-cb5f-4168-82b2-fc0266c56e52"},"spec":{"progressDeadlineSeconds":600,"replicas":1,"revisionHistoryLimit":10,"selector":{"matchLabels":{"app":"web"}},"strategy":{"rollingUpdate":{"maxSurge":"25%","maxUnavailable":"25%"},"type":"RollingUpdate"},"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"web"}},"spec":{"containers":[{"image":"nginx:1.17","imagePullPolicy":"Always","name":"nginx","resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File"}],"dnsPolicy":"ClusterFirst","restartPolicy":"Always","schedulerName":"default-scheduler","securityContext":{},"terminationGracePeriodSeconds":30}}},"status":{"availableReplicas":1,"conditions":[{"lastTransitionTime":"2023-05-08T13:56:03Z","lastUpdateTime":"2023-05-08T13:56:03Z","message":"Deployment has minimum availability.","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2023-05-08T13:55:49Z","lastUpdateTime":"2023-05-08T13:56:03Z","message":"ReplicaSet \"web-96d5df5c8\" has successfully progressed.","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":1,"replicas":1,"updatedReplicas":1}}
  creationTimestamp: "2023-08-12T07:23:41Z"
  generation: 1
  labels:
    app: web
  name: web
  namespace: dalong-test-1
  resourceVersion: "816863"
  uid: 75552def-ddb5-4f97-81fb-d06cb5128432
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: web
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: web
    spec:
      containers:
      - image: nginx:1.17
        imagePullPolicy: Always
        name: nginx
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - name: data
          mountPath: /usr/share/nginx/html
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: data
        emptyDir: {}
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2023-08-12T07:51:46Z"
    lastUpdateTime: "2023-08-12T07:51:46Z"
    message: ReplicaSet "web-7675fc7857" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  - lastTransitionTime: "2023-08-19T06:04:37Z"
    lastUpdateTime: "2023-08-19T06:04:37Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  observedGeneration: 1
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1
相关推荐
匆匆z24 分钟前
AWS EC2 微服务 金丝雀发布(Canary Release)方案
微服务·云原生·金丝雀部署
富士康质检员张全蛋39 分钟前
云原生|kubernetes|kubernetes的etcd集群备份策略
云原生·kubernetes·etcd
慧一居士1 小时前
Kubernetes 中kind类型和各类型详细配置完整示例介绍
云原生·kubernetes·yaml配置
云手机管家2 小时前
CDN加速对云手机延迟的影响
运维·服务器·网络·容器·智能手机·矩阵·自动化
孤的心了不冷2 小时前
【Docker】CentOS 8.2 安装Docker教程
linux·运维·docker·容器·eureka·centos
头疼的程序员3 小时前
docker学习与使用(概念、镜像、容器、数据卷、dockerfile等)
学习·docker·容器
淡水猫.3 小时前
hbit资产收集工具Docker(笔记版)
运维·docker·容器
水淹萌龙9 小时前
k8s 中使用 Service 访问时NetworkPolicy不生效问题排查
云原生·容器·kubernetes
alden_ygq11 小时前
K8S cgroups详解
容器·贪心算法·kubernetes
旧故新长12 小时前
访问 Docker 官方镜像源(包括代理)全部被“重置连接”或超时
运维·docker·容器