12.k8s的存储卷创建过程

可莉
• 阅读 753

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

[root@master song]# cat pod-demo.yml 
apiVersion: v1
kind: Pod
metadata: 
  name: pod-demo
  namespace: default
  labels:
    app: myapp
    tier: frontend
    2sdlfj: dashazi
spec:
  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:
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:
Host Port:
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:
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:
Host Port:
State: Running
Started: Sun, 03 Mar 2019 09:42:01 +0800
Ready: True
Restart Count: 0
Environment:
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

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
待兔 待兔
4个月前
手写Java HashMap源码
HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22
Jacquelyn38 Jacquelyn38
3年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
Stella981 Stella981
3年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Easter79 Easter79
3年前
Twitter的分布式自增ID算法snowflake (Java版)
概述分布式系统中,有一些需要使用全局唯一ID的场景,这种时候为了防止ID冲突可以使用36位的UUID,但是UUID有一些缺点,首先他相对比较长,另外UUID一般是无序的。有些时候我们希望能使用一种简单一些的ID,并且希望ID能够按照时间有序生成。而twitter的snowflake解决了这种需求,最初Twitter把存储系统从MySQL迁移
Stella981 Stella981
3年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
3年前
ES6 新增的数组的方法
给定一个数组letlist\//wu:武力zhi:智力{id:1,name:'张飞',wu:97,zhi:10},{id:2,name:'诸葛亮',wu:55,zhi:99},{id:3,name:'赵云',wu:97,zhi:66},{id:4,na
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
10个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这