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
相关推荐
kaiyuanheshang9 小时前
docker 中的entrypoint和cmd指令
运维·docker·容器·cmd·entrypoint
Python私教10 小时前
除了 Docker,还有哪些类似的容器技术?
运维·docker·容器
hummhumm14 小时前
第33章 - Go语言 云原生开发
java·开发语言·后端·python·sql·云原生·golang
petaexpress14 小时前
5种常见的k8s云原生数据管理方案详解
云原生·kubernetes·k8s云原生
wenyue112115 小时前
云原生开发框架
数据库·云原生
颜淡慕潇15 小时前
【K8S系列】深入解析 Kubernetes 中的 Deployment
后端·云原生·容器·kubernetes
zwm_yy17 小时前
docker-mysql
mysql·docker·容器
FinelyYang20 小时前
docker+容器+redis+minio+java jar,实现开机自启动
运维·docker·容器
蚂蚁在飞-21 小时前
云原生时代的轻量级反向代理Traefik
云原生·golang