Kubernetes---Volume存储卷

一、Volume存储卷简介

Volume将容器中的指定数据和容器解耦, 并将数据存储到指定的位置, 不同的存储卷功能不一样, 如果是基于网络存储的存储卷可以可实现容器间的数据共享和持久化。
静态存储卷需要在使用前手动创建PV和PVC, 然后绑定至pod使用。
常用的几种卷:

  • Secret: 是一种包含少量敏感信息例如密码、 令牌或密钥的对象
  • configmap: 配置文件
  • emptyDir: 本地临时卷
  • hostPath: 本地存储卷
  • nfs等: 网络存储卷

官方介绍:https://kubernetes.io/zh/docs/concepts/storage/volumes/

二、emptyDir测试

       当 Pod 被分配给节点时, 首先创建 emptyDir 卷,并且只要该 Pod 在该节点上运行,该卷就会存在,正如卷的名字所述,它最初是空的,Pod 中的容器可以读取和写入 emptyDir 卷中的相同文件,尽管该卷可以挂载到每个容器中的相同或不同路径上。 当出于任何原因从节点中删除 Pod 时, emptyDir 中的数据将被永久删除。

 emptyDir测试

root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case3# cat deploy_empty.yml 
#apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 1
  selector:
    matchLabels: #rs or deployment
      app: ng-deploy-80
  template:
    metadata:
      labels:
        app: ng-deploy-80
    spec:
      containers:
      - name: ng-deploy-80
        image: nginx 
        ports:
        - containerPort: 80
        volumeMounts:
        - mountPath: /cache
          name: cache-volume-n70
      volumes:
      - name: cache-volume-n70
        emptyDir: {}
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case3# kubectl apply -f deploy_empty.yml #宿主机没有的目录会由kubelet新建 
deployment.apps
/nginx-deployment created root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case3# kubectl get pod NAME READY STATUS RESTARTS AGE mysql-77d55bfdd8-cbtcz 1/1 Running 2 (2d11h ago) 3d10h nginx-deployment-5456b77c9d-27dgp 1/1 Running 0 50s root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case3# kubectl exec -it nginx-deployment-5456b77c9d-27dgp bash kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead. root@nginx-deployment-5456b77c9d-27dgp:/# df -h Filesystem Size Used Avail Use% Mounted on overlay 48G 13G 33G 28% / tmpfs 64M 0 64M 0% /dev tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/mapper/ubuntu--vg-ubuntu--lv 48G 13G 33G 28% /cache shm 64M 0 64M 0% /dev/shm tmpfs 7.5G 12K 7.5G 1% /run/secrets/kubernetes.io/serviceaccount tmpfs 3.9G 0 3.9G 0% /proc/acpi tmpfs 3.9G 0 3.9G 0% /proc/scsi tmpfs 3.9G 0 3.9G 0% /sys/firmware root@nginx-deployment-5456b77c9d-27dgp:/#

三、hostPath

hostPath 卷将主机节点的文件系统中的文件或目录挂载到集群中, pod删除的时候, 卷不会被删除

hostPath测试

root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case4# vi deploy_hostPath.yml 
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case4# cat deploy_hostPath.yml 
#apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ng-deploy-80
  template:
    metadata:
      labels:
        app: ng-deploy-80
    spec:
      containers:
      - name: ng-deploy-80
        image: nginx 
        ports:
        - containerPort: 80
        volumeMounts:
        - mountPath: /data/n70
          name: cache-n70-volume
      volumes:
      - name: cache-n70-volume
        hostPath:
          path: /opt/n70
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case4# 
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case4# kubectl apply -f deploy_hostPath.yml 
deployment.apps/nginx-deployment created
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case4# kubectl get pod -owide
NAME                               READY   STATUS    RESTARTS   AGE   IP               NODE            NOMINATED NODE   READINESS GATES
nginx-deployment-75b469846-gfr6v   1/1     Running   0          16s   10.200.104.231   172.16.88.163   <none>           <none>
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case4# 
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case4# kubectl exec -it nginx-deployment-75b469846-gfr6v bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@nginx-deployment-75b469846-gfr6v:/# df -h
Filesystem                         Size  Used Avail Use% Mounted on
overlay                             48G   13G   33G  28% /
tmpfs                               64M     0   64M   0% /dev
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/ubuntu--vg-ubuntu--lv   48G   13G   33G  28% /data/n70
shm                                 64M     0   64M   0% /dev/shm
tmpfs                              7.5G   12K  7.5G   1% /run/secrets/kubernetes.io/serviceaccount
tmpfs                              3.9G     0  3.9G   0% /proc/acpi
tmpfs                              3.9G     0  3.9G   0% /proc/scsi
tmpfs                              3.9G     0  3.9G   0% /sys/firmware
root@nginx-deployment-75b469846-gfr6v:/#
#宿主机查看多了个n70目录
[root@easzlab-k8s-node-04 ~]# ll -h /opt total 28K drwxr-xr-x 7 root root 4.0K Oct 22 10:40 ./ drwxr-xr-x 20 root root 4.0K Oct 20 16:28 ../ drwx--x--x 4 root root 4.0K Oct 18 17:06 containerd/ drwxr-xr-x 3 root root 4.0K Oct 13 20:28 kube/ drwxr-xr-x 2 root root 4.0K Oct 22 10:37 n70/ drwxr-xr-x 2 root root 4.0K Oct 13 23:34 node_exporter/ drwxr-xr-x 2 root root 4.0K Oct 13 23:34 process-exporter/ [root@easzlab-k8s-node-04 ~]#
[root@easzlab-k8s-node-04 ~]# cd /opt/n70/
[root@easzlab-k8s-node-04 n70]# ls
[root@easzlab-k8s-node-04 n70]# touch test-{01..09}.txt  #在宿主机创建文件
[root@easzlab-k8s-node-04 n70]# ll -h
total 8.0K
drwxr-xr-x 2 root root 4.0K Oct 22 10:44 ./
drwxr-xr-x 7 root root 4.0K Oct 22 10:40 ../
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-01.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-02.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-03.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-04.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-05.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-06.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-07.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-08.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-09.txt
[root@easzlab-k8s-node-04 n70]# 
root@nginx-deployment-75b469846-gfr6v:/data/n70# ls -lh #立即映射到容器内部
total 0 
-rw-r--r-- 1 root root 0 Oct 22 02:44 test-01.txt
-rw-r--r-- 1 root root 0 Oct 22 02:44 test-02.txt
-rw-r--r-- 1 root root 0 Oct 22 02:44 test-03.txt
-rw-r--r-- 1 root root 0 Oct 22 02:44 test-04.txt
-rw-r--r-- 1 root root 0 Oct 22 02:44 test-05.txt
-rw-r--r-- 1 root root 0 Oct 22 02:44 test-06.txt
-rw-r--r-- 1 root root 0 Oct 22 02:44 test-07.txt
-rw-r--r-- 1 root root 0 Oct 22 02:44 test-08.txt
-rw-r--r-- 1 root root 0 Oct 22 02:44 test-09.txt
root@nginx-deployment-75b469846-gfr6v:/data/n70#
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case4# kubectl delete -f deploy_hostPath.yml #删除pod,此时宿主机文件还存在
deployment.apps "nginx-deployment" deleted
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case4# kubectl get pod
No resources found in default namespace.
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case4# 
[root@easzlab-k8s-node-04 ~]# ll -h /opt/
total 28K
drwxr-xr-x  7 root root 4.0K Oct 22 10:40 ./
drwxr-xr-x 20 root root 4.0K Oct 20 16:28 ../
drwx--x--x  4 root root 4.0K Oct 18 17:06 containerd/
drwxr-xr-x  3 root root 4.0K Oct 13 20:28 kube/
drwxr-xr-x  2 root root 4.0K Oct 22 10:44 n70/
drwxr-xr-x  2 root root 4.0K Oct 13 23:34 node_exporter/
drwxr-xr-x  2 root root 4.0K Oct 13 23:34 process-exporter/
[root@easzlab-k8s-node-04 ~]# ll -h /opt/n70/
total 8.0K
drwxr-xr-x 2 root root 4.0K Oct 22 10:44 ./
drwxr-xr-x 7 root root 4.0K Oct 22 10:40 ../
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-01.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-02.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-03.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-04.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-05.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-06.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-07.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-08.txt
-rw-r--r-- 1 root root    0 Oct 22 10:44 test-09.txt
[root@easzlab-k8s-node-04 ~]# 

四、nfs共享存储

      nfs 卷允许将现有的 NFS(网络文件系统) 挂载到容器中, 且不像 emptyDir会丢失数据, 当删除 Pod 时, nfs 卷的内容被保留, 卷仅仅是被卸载, 这意味着 NFS 卷可以预先上传好数据待pod启动后即可直接使用, 并且网络存储可以在多 pod 之间共享同一份数据, 即NFS 可以被多个pod同时挂载和读写。

 

创建多个pod测试挂载同一个NFS

[root@easzlab-k8s-nfs-01 ~]# mkdir -p /data/magedu/n70  #在nfs节点创建nfs共享目录
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# cat deploy_nfs.yml #apiVersion: extensions/v1beta1 apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 3 #设置多个pod副本 selector: matchLabels: app: ng-deploy-80 template: metadata: labels: app: ng-deploy-80 spec: containers: - name: ng-deploy-80 image: nginx ports: - containerPort: 80 volumeMounts: - mountPath: /usr/share/nginx/html/mysite name: my-nfs-volume - mountPath: /usr/share/nginx/html/js name: my-nfs-js volumes: - name: my-nfs-volume nfs: server: 172.16.88.169 path: /data/magedu/n70 - name: my-nfs-js nfs: server: 172.16.88.169 path: /data/magedu/n70 --- apiVersion: v1 kind: Service metadata: name: ng-deploy-80 spec: ports: - name: http port: 81 targetPort: 80 nodePort: 30016 protocol: TCP type: NodePort selector: app: ng-deploy-80 root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl apply -f deploy_nfs.yml deployment.apps/nginx-deployment created service/ng-deploy-80 created root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5#
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl get pod -owide
NAME                                READY   STATUS    RESTARTS   AGE     IP               NODE            NOMINATED NODE   READINESS GATES
nginx-deployment-5dc89d5c99-lt4fh   1/1     Running   0          3m17s   10.200.40.199    172.16.88.160   <none>           <none>
nginx-deployment-5dc89d5c99-tv65r   1/1     Running   0          3m17s   10.200.104.235   172.16.88.163   <none>           <none>
nginx-deployment-5dc89d5c99-vgxf6   1/1     Running   0          3m17s   10.200.105.164   172.16.88.164   <none>           <none>
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# 

创建文件测试

[root@easzlab-k8s-nfs-01 n70]# touch index-test.html
[root@easzlab-k8s-nfs-01 n70]# ll -h 
total 0
drwxr-xr-x 2 root root 29 Oct 22 11:07 ./
drwxr-xr-x 3 root root 17 Oct 22 10:57 ../
-rw-r--r-- 1 root root  0 Oct 22 11:07 index-test.html
[root@easzlab-k8s-nfs-01 n70]#
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl get pod -owide
NAME                                READY   STATUS    RESTARTS   AGE     IP               NODE            NOMINATED NODE   READINESS GATES
nginx-deployment-5dc89d5c99-lt4fh   1/1     Running   0          3m17s   10.200.40.199    172.16.88.160   <none>           <none>
nginx-deployment-5dc89d5c99-tv65r   1/1     Running   0          3m17s   10.200.104.235   172.16.88.163   <none>           <none>
nginx-deployment-5dc89d5c99-vgxf6   1/1     Running   0          3m17s   10.200.105.164   172.16.88.164   <none>           <none>
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# 
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl exec -it nginx-deployment-5dc89d5c99-lt4fh bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@nginx-deployment-5dc89d5c99-lt4fh:/# df -h
Filesystem                         Size  Used Avail Use% Mounted on
overlay                             48G  9.5G   36G  21% /
tmpfs                               64M     0   64M   0% /dev
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/ubuntu--vg-ubuntu--lv   48G  9.5G   36G  21% /etc/hosts
shm                                 64M     0   64M   0% /dev/shm
tmpfs                              7.5G   12K  7.5G   1% /run/secrets/kubernetes.io/serviceaccount
172.16.88.169:/data/magedu/n70     200G  1.5G  199G   1% /usr/share/nginx/html/js
tmpfs                              3.9G     0  3.9G   0% /proc/acpi
tmpfs                              3.9G     0  3.9G   0% /proc/scsi
tmpfs                              3.9G     0  3.9G   0% /sys/firmware
root@nginx-deployment-5dc89d5c99-lt4fh:/# ls -lh /usr/share/nginx/html/js
total 0
-rw-r--r-- 1 root root 0 Oct 22 03:07 index-test.html
root@nginx-deployment-5dc89d5c99-lt4fh:/# ls -lh /usr/share/nginx/html/mysite/
total 0
-rw-r--r-- 1 root root 0 Oct 22 03:07 index-test.html
root@nginx-deployment-5dc89d5c99-lt4fh:/# exit
exit
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl exec -it nginx-deployment-5dc89d5c99-tv65r bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@nginx-deployment-5dc89d5c99-tv65r:/# df -h
Filesystem                         Size  Used Avail Use% Mounted on
overlay                             48G   13G   33G  28% /
tmpfs                               64M     0   64M   0% /dev
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/ubuntu--vg-ubuntu--lv   48G   13G   33G  28% /etc/hosts
shm                                 64M     0   64M   0% /dev/shm
tmpfs                              7.5G   12K  7.5G   1% /run/secrets/kubernetes.io/serviceaccount
172.16.88.169:/data/magedu/n70     200G  1.5G  199G   1% /usr/share/nginx/html/js
tmpfs                              3.9G     0  3.9G   0% /proc/acpi
tmpfs                              3.9G     0  3.9G   0% /proc/scsi
tmpfs                              3.9G     0  3.9G   0% /sys/firmware
root@nginx-deployment-5dc89d5c99-tv65r:/# ls -lh /usr/share/nginx/html/js
total 0
-rw-r--r-- 1 root root 0 Oct 22 03:07 index-test.html
root@nginx-deployment-5dc89d5c99-tv65r:/# 
root@nginx-deployment-5dc89d5c99-tv65r:/# ls -lh /usr/share/nginx/html/mysite/
total 0
-rw-r--r-- 1 root root 0 Oct 22 03:07 index-test.html
root@nginx-deployment-5dc89d5c99-tv65r:/# 
root@nginx-deployment-5dc89d5c99-tv65r:/# exit
exit
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl exec -it nginx-deployment-5dc89d5c99-vgxf6 bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@nginx-deployment-5dc89d5c99-vgxf6:/# df -h
Filesystem                         Size  Used Avail Use% Mounted on
overlay                             48G   12G   34G  26% /
tmpfs                               64M     0   64M   0% /dev
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/ubuntu--vg-ubuntu--lv   48G   12G   34G  26% /etc/hosts
shm                                 64M     0   64M   0% /dev/shm
tmpfs                              7.5G   12K  7.5G   1% /run/secrets/kubernetes.io/serviceaccount
172.16.88.169:/data/magedu/n70     200G  1.5G  199G   1% /usr/share/nginx/html/js
tmpfs                              3.9G     0  3.9G   0% /proc/acpi
tmpfs                              3.9G     0  3.9G   0% /proc/scsi
tmpfs                              3.9G     0  3.9G   0% /sys/firmware
root@nginx-deployment-5dc89d5c99-vgxf6:/# 
root@nginx-deployment-5dc89d5c99-vgxf6:/# ls -lh /usr/share/nginx/html/js/
total 0
-rw-r--r-- 1 root root 0 Oct 22 03:07 index-test.html
root@nginx-deployment-5dc89d5c99-vgxf6:/# 
root@nginx-deployment-5dc89d5c99-vgxf6:/# ls -lh /usr/share/nginx/html/mysite/
total 0
-rw-r--r-- 1 root root 0 Oct 22 03:07 index-test.html
root@nginx-deployment-5dc89d5c99-vgxf6:/# 

创建多个pod测试每个pod挂载多个NFS

[root@easzlab-k8s-nfs-01 ~]# mkdir /data/k8sdata/pool{1,2}
[root@easzlab-k8s-nfs-01 ~]# ll -h /data/k8sdata/
total 0
drwxr-xr-x 4 root root 32 Oct 22 11:22 ./
drwxr-xr-x 4 root root 35 Oct 22 11:15 ../
drwxr-xr-x 2 root root  6 Oct 22 11:22 pool1/
drwxr-xr-x 2 root root  6 Oct 22 11:22 pool2/
[root@easzlab-k8s-nfs-01 ~]# 
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# vi deploy_nfs2.yml 
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# cat deploy_nfs2.yml 
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment-site2
spec:
  replicas: 3
  selector:
    matchLabels:
      app: ng-deploy-81
  template:
    metadata:
      labels:
        app: ng-deploy-81
    spec:
      containers:
      - name: ng-deploy-81
        image: nginx 
        ports:
        - containerPort: 80
        volumeMounts:
        - mountPath: /usr/share/nginx/html/pool1
          name: my-nfs-volume-pool1
        - mountPath: /usr/share/nginx/html/pool2
          name: my-nfs-volume-pool2
      volumes:
      - name: my-nfs-volume-pool1
        nfs:
          server: 172.16.88.169
          path: /data/k8sdata/pool1
      - name: my-nfs-volume-pool2
        nfs:
          server: 172.16.88.169
          path: /data/k8sdata/pool2

---
apiVersion: v1
kind: Service
metadata:
  name: ng-deploy-81
spec:
  ports:
  - name: http
    port: 80
    targetPort: 80
    nodePort: 30017
    protocol: TCP
  type: NodePort
  selector:
    app: ng-deploy-81
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl apply -f deploy_nfs2.yml 
deployment.apps/nginx-deployment-site2 created
service/ng-deploy-81 created
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl get pod -owide
NAME                                      READY   STATUS    RESTARTS   AGE   IP               NODE            NOMINATED NODE   READINESS GATES
nginx-deployment-site2-76fb9f9b7f-dt7pm   1/1     Running   0          20s   10.200.233.99    172.16.88.161   <none>           <none>
nginx-deployment-site2-76fb9f9b7f-jfpnt   1/1     Running   0          21s   10.200.104.234   172.16.88.163   <none>           <none>
nginx-deployment-site2-76fb9f9b7f-mr6nv   1/1     Running   0          20s   10.200.105.163   172.16.88.164   <none>           <none>
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# 

验证pod挂载

root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl get pod -owide
NAME                                      READY   STATUS    RESTARTS   AGE   IP               NODE            NOMINATED NODE   READINESS GATES
nginx-deployment-site2-76fb9f9b7f-dt7pm   1/1     Running   0          20s   10.200.233.99    172.16.88.161   <none>           <none>
nginx-deployment-site2-76fb9f9b7f-jfpnt   1/1     Running   0          21s   10.200.104.234   172.16.88.163   <none>           <none>
nginx-deployment-site2-76fb9f9b7f-mr6nv   1/1     Running   0          20s   10.200.105.163   172.16.88.164   <none>           <none>
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# 
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl exec -it nginx-deployment-site2-76fb9f9b7f-dt7pm bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@nginx-deployment-site2-76fb9f9b7f-dt7pm:/# df -h
Filesystem                         Size  Used Avail Use% Mounted on
overlay                             48G   13G   33G  28% /
tmpfs                               64M     0   64M   0% /dev
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/ubuntu--vg-ubuntu--lv   48G   13G   33G  28% /etc/hosts
shm                                 64M     0   64M   0% /dev/shm
tmpfs                              7.5G   12K  7.5G   1% /run/secrets/kubernetes.io/serviceaccount
172.16.88.169:/data/k8sdata/pool1  200G  1.5G  199G   1% /usr/share/nginx/html/pool1
172.16.88.169:/data/k8sdata/pool2  200G  1.5G  199G   1% /usr/share/nginx/html/pool2
tmpfs                              3.9G     0  3.9G   0% /proc/acpi
tmpfs                              3.9G     0  3.9G   0% /proc/scsi
tmpfs                              3.9G     0  3.9G   0% /sys/firmware
root@nginx-deployment-site2-76fb9f9b7f-dt7pm:/# exit
exit
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl exec -it nginx-deployment-site2-76fb9f9b7f-jfpnt bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@nginx-deployment-site2-76fb9f9b7f-jfpnt:/# df -h
Filesystem                         Size  Used Avail Use% Mounted on
overlay                             48G   13G   33G  28% /
tmpfs                               64M     0   64M   0% /dev
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/ubuntu--vg-ubuntu--lv   48G   13G   33G  28% /etc/hosts
shm                                 64M     0   64M   0% /dev/shm
tmpfs                              7.5G   12K  7.5G   1% /run/secrets/kubernetes.io/serviceaccount
172.16.88.169:/data/k8sdata/pool1  200G  1.5G  199G   1% /usr/share/nginx/html/pool1
172.16.88.169:/data/k8sdata/pool2  200G  1.5G  199G   1% /usr/share/nginx/html/pool2
tmpfs                              3.9G     0  3.9G   0% /proc/acpi
tmpfs                              3.9G     0  3.9G   0% /proc/scsi
tmpfs                              3.9G     0  3.9G   0% /sys/firmware
root@nginx-deployment-site2-76fb9f9b7f-jfpnt:/# exit
exit
root@easzlab-deploy:~/jiege-k8s/pod-test/case-yaml/case5# kubectl exec -it nginx-deployment-site2-76fb9f9b7f-mr6nv bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@nginx-deployment-site2-76fb9f9b7f-mr6nv:/# df -h
Filesystem                         Size  Used Avail Use% Mounted on
overlay                             48G   12G   34G  26% /
tmpfs                               64M     0   64M   0% /dev
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/ubuntu--vg-ubuntu--lv   48G   12G   34G  26% /etc/hosts
shm                                 64M     0   64M   0% /dev/shm
tmpfs                              7.5G   12K  7.5G   1% /run/secrets/kubernetes.io/serviceaccount
172.16.88.169:/data/k8sdata/pool1  200G  1.5G  199G   1% /usr/share/nginx/html/pool1
172.16.88.169:/data/k8sdata/pool2  200G  1.5G  199G   1% /usr/share/nginx/html/pool2
tmpfs                              3.9G     0  3.9G   0% /proc/acpi
tmpfs                              3.9G     0  3.9G   0% /proc/scsi
tmpfs                              3.9G     0  3.9G   0% /sys/firmware
root@nginx-deployment-site2-76fb9f9b7f-mr6nv:/# 

 

posted @ 2022-10-22 11:44  cyh00001  阅读(82)  评论(0编辑  收藏  举报