博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
12.k8s的存储卷创建过程
阅读量:5123 次
发布时间:2019-06-13

本文共 7087 字,大约阅读时间需要 23 分钟。

数据持久化需要数据卷。kubernetes生态提供海量的存储驱动和存储使用方式。

[root@master song]# cat pod-demo.yml apiVersion: v1kind: Podmetadata:   name: pod-demo  namespace: default  labels:    app: myapp    tier: frontend    2sdlfj: dashazispec:  containers:  - name: centos    image: busybox    command: ["/bin/sh","-c","ping www.baidu.com"]    volumeMounts:    - name: song      mountPath: /data  - name: myapp-1    image: hub.c.163.com/library/nginx:1.13    volumeMounts:    - name: song      mountPath: /data  nodeSelector:    location: slave1  volumes:  - name: song    emptyDir: {} 查看状态

[root@master song]# kubectl describe pod pod-demo

Name: pod-demo
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: k8s-node1/172.20.0.76
Start Time: Sun, 03 Mar 2019 09:41:53 +0800
Labels: 2sdlfj=dashazi
app=myapp
tier=frontend
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"labels":{"2sdlfj":"dashazi","app":"myapp","tier":"frontend"},"name":"pod-dem...
Status: Running
IP: 10.244.2.183
Containers:
centos:
Container ID: docker://4bc862140523df128ab1c35375459f5a08cbab3bbeb787b35ae607016bb18071
Image: busybox
Image ID: docker-pullable://busybox@sha256:061ca9704a714ee3e8b80523ec720c64f6209ad3f97c0ff7cb9ec7d19f15149f
Port: <none>
Host Port: <none>
Command:
/bin/sh
-c
ping www.baidu.com
State: Running
Started: Sun, 03 Mar 2019 09:42:01 +0800
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/data from song (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-tlx48 (ro)
myapp-1:
Container ID: docker://b32921dc906b58bfdf146e9a094748d7af80d21e24b58c17f6ffdc08fdee1752
Image: hub.c.163.com/library/nginx:1.13
Image ID: docker-pullable://hub.c.163.com/library/nginx@sha256:ff094de32a0d3b5efc29cec60daa709c5378cf4e53e4c9fd1d3433b87ac8ec8b
Port: <none>
Host Port: <none>
State: Running
Started: Sun, 03 Mar 2019 09:42:01 +0800
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/data from song (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-tlx48 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
song:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)  说明该类型为临时文件,不会存盘。
Medium:
default-token-tlx48:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-tlx48
Optional: false
QoS Class: BestEffort
Node-Selectors: location=slave1
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Pulling 7h9m kubelet, k8s-node1 pulling image "busybox"
Normal Pulled 7h9m kubelet, k8s-node1 Successfully pulled image "busybox"
Normal Created 7h9m kubelet, k8s-node1 Created container
Normal Started 7h9m kubelet, k8s-node1 Started container
Normal Pulled 7h9m kubelet, k8s-node1 Container image "hub.c.163.com/library/nginx:1.13" already present on machine
Normal Created 7h9m kubelet, k8s-node1 Created container
Normal Started 7h9m kubelet, k8s-node1 Started container
Normal Scheduled 71s default-scheduler Successfully assigned default/pod-demo to k8s-node1
[root@master song]# kubectl exec -i -t pod-demo -c centos -- /bin/sh
/ # cd /data
/data # cat /proc/mounts
rootfs / rootfs rw 0 0
overlay / overlay rw,relatime,lowerdir=/var/lib/docker/overlay2/l/XHB5NUDL4LLGOC3EZHZJ6C2U2R:/var/lib/docker/overlay2/l/Q2CWFPROIF2I4BB6RJY5CAM74J,upperdir=/var/lib/docker/overlay2/bae727cbe291547d5703c4d488afee8b1394e2abd8bb9a271ac73bfff2468365/diff,workdir=/var/lib/docker/overlay2/bae727cbe291547d5703c4d488afee8b1394e2abd8bb9a271ac73bfff2468365/work 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,size=65536k,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666 0 0
sysfs /sys sysfs ro,nosuid,nodev,noexec,relatime 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,relatime,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup ro,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup ro,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0
cgroup /sys/fs/cgroup/pids cgroup ro,nosuid,nodev,noexec,relatime,pids 0 0
cgroup /sys/fs/cgroup/hugetlb cgroup ro,nosuid,nodev,noexec,relatime,hugetlb 0 0
cgroup /sys/fs/cgroup/freezer cgroup ro,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/cpuset cgroup ro,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/blkio cgroup ro,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup ro,nosuid,nodev,noexec,relatime,net_prio,net_cls 0 0
cgroup /sys/fs/cgroup/devices cgroup ro,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/perf_event cgroup ro,nosuid,nodev,noexec,relatime,perf_event 0 0
cgroup /sys/fs/cgroup/memory cgroup ro,nosuid,nodev,noexec,relatime,memory 0 0
mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0
/dev/mapper/centos_bogon-root /data ext4 rw,relatime,data=ordered 0 0
/dev/mapper/centos_bogon-root /dev/termination-log ext4 rw,relatime,data=ordered 0 0
/dev/mapper/centos_bogon-root /etc/resolv.conf ext4 rw,relatime,data=ordered 0 0
/dev/mapper/centos_bogon-root /etc/hostname ext4 rw,relatime,data=ordered 0 0
/dev/mapper/centos_bogon-root /etc/hosts ext4 rw,relatime,data=ordered 0 0
shm /dev/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=65536k 0 0
tmpfs /var/run/secrets/kubernetes.io/serviceaccount tmpfs ro,relatime 0 0
proc /proc/bus proc ro,relatime 0 0
proc /proc/fs proc ro,relatime 0 0
proc /proc/irq proc ro,relatime 0 0
proc /proc/sys proc ro,relatime 0 0
proc /proc/sysrq-trigger proc ro,relatime 0 0
tmpfs /proc/acpi tmpfs ro,relatime 0 0
tmpfs /proc/kcore tmpfs rw,nosuid,size=65536k,mode=755 0 0
tmpfs /proc/keys tmpfs rw,nosuid,size=65536k,mode=755 0 0
tmpfs /proc/timer_list tmpfs rw,nosuid,size=65536k,mode=755 0 0
tmpfs /proc/timer_stats tmpfs rw,nosuid,size=65536k,mode=755 0 0
tmpfs /proc/sched_debug tmpfs rw,nosuid,size=65536k,mode=755 0 0
tmpfs /proc/scsi tmpfs ro,relatime 0 0
tmpfs /sys/firmware tmpfs ro,relatime 0 0
/data # df -h
Filesystem Size Used Available Use% Mounted on
overlay 9.7G 4.6G 4.6G 50% /
tmpfs 64.0M 0 64.0M 0% /dev
tmpfs 999.5M 0 999.5M 0% /sys/fs/cgroup
/dev/mapper/centos_bogon-root
9.7G 4.6G 4.6G 50% /data
/dev/mapper/centos_bogon-root
9.7G 4.6G 4.6G 50% /dev/termination-log
/dev/mapper/centos_bogon-root
9.7G 4.6G 4.6G 50% /etc/resolv.conf
/dev/mapper/centos_bogon-root
9.7G 4.6G 4.6G 50% /etc/hostname
/dev/mapper/centos_bogon-root
9.7G 4.6G 4.6G 50% /etc/hosts
shm 64.0M 0 64.0M 0% /dev/shm
tmpfs 999.5M 12.0K 999.5M 0% /var/run/secrets/kubernetes.io/serviceaccount
tmpfs 999.5M 0 999.5M 0% /proc/acpi
tmpfs 64.0M 0 64.0M 0% /proc/kcore
tmpfs 64.0M 0 64.0M 0% /proc/keys
tmpfs 64.0M 0 64.0M 0% /proc/timer_list
tmpfs 64.0M 0 64.0M 0% /proc/timer_stats
tmpfs 64.0M 0 64.0M 0% /proc/sched_debug
tmpfs 999.5M 0 999.5M 0% /proc/scsi
tmpfs 999.5M 0 999.5M 0% /sys/firmware

转载于:https://www.cnblogs.com/leleyao/p/10464322.html

你可能感兴趣的文章
CF 208E. Blood Cousins [dsu on tree 倍增]
查看>>
趣谈面试(一)
查看>>
Quart2D setNeedsDisplay
查看>>
设计模式之策略设计模式
查看>>
Sql server 从一个表中获取数据更新到另一个表中
查看>>
JS继承的实现方式 原型 原型链 prototype和_proto_的区别
查看>>
[bzoj3622] 已经没有什么好害怕的了
查看>>
Objective-c 中 nil, Nil, NULL和NSNull的区别
查看>>
解决Ubuntu编译内核uImage出现问题“mkimage” command not found - U-Boot
查看>>
NOIP2018退役记
查看>>
第三次作业-功能测试
查看>>
(C++)浅谈using namespace std
查看>>
Http协议与生命周期
查看>>
Filter过滤器
查看>>
HTML5新标签在低版本浏览器中兼容性Checklist (hacks and issues)
查看>>
Laravel框架使用的一些注意细节(一)
查看>>
android-------非常好的图片加载框架和缓存库(Picasso)
查看>>
一次Redis 的性能测试和问题 [问题已经自己解决,见文章最后]
查看>>
原型模式(Prototype)
查看>>
Oracle数据库备份与恢复
查看>>