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
相关推荐
藥瓿亭1 小时前
K8S认证|CKS题库+答案| 6. 创建 Secret
运维·ubuntu·docker·云原生·容器·kubernetes·cks
2302_809798321 小时前
【JavaWeb】Docker项目部署
java·运维·后端·青少年编程·docker·容器
嵌入式大圣2 小时前
Neko虚拟浏览器远程协作方案:Docker+内网穿透技术部署实践
运维·docker·容器
孔令飞2 小时前
Kubernetes 节点自动伸缩(Cluster Autoscaler)原理与实践
ai·云原生·容器·golang·kubernetes
极简网络科技4 小时前
Docker、Wsl 打包迁移环境
运维·docker·容器
江湖有缘4 小时前
【Docker管理工具】部署Docker可视化管理面板Dpanel
运维·docker·容器
猫咪老师19955 小时前
多系统一键打包docker compose下所有镜像并且使用
java·docker·容器
Nazi66 小时前
docker数据管理
运维·docker·容器
洛神灬殇7 小时前
【LLM大模型技术专题】「入门到精通系列教程」基于ai-openai-spring-boot-starter集成开发实战指南
网络·数据库·微服务·云原生·架构
上海运维Q先生8 小时前
Cilium动手实验室: 精通之旅---11.Advanced BGP Features - Lab
云原生·k8s·cilium