pod实例数是什么意思_[灌水] Kubernetes In Action: Pod

Pod

pod 可以有多个 副本,比如 slave 实际上是 pod 的副本,单一的 pod 存在唯一的 node 上。

  • IP 分配的单位, pod 容器共享
  • pod 容器共享 volume, pod所有容器可以共享多个 docker 容器的 fs 下的 volume
  • 同一个pod 容器可以共享 IPC UTS namespace
  • pod 拥有属性 labels,key 独一无二,1当成是 map

pod 信息有:

  • Shared storage, as Volumes
  • Networking, as a unique cluster IP address
  • Information about how to run each container, such as the container image version or specific ports to use
我们之前说过, pod 类似逻辑主机, 在逻辑主机中运行的进程共享诸如 CPU 、 RAM、 网络接口等资源。 入们会期望进程也能共享磁盘, 但事实并非如此。 需要谨 记 一 点, pod 中的每个容器都有自己独立的文件系统, 因为文件系统来自容器镜像。

pods

apiVersion: v1
kind: Pod # P 要大写
metadata:
  name: mwish-bot
spec:
  containers:
  - image: redis
    name: mredis
    ports:
    - containerPort: 6379
      protocol: TCP

然后在这里可以:

kubectl create -f p.yaml

第一次 check 的时候:

➜  k8s kubectl get pods
NAME        READY   STATUS              RESTARTS   AGE
mwish-bot   0/1     ContainerCreating   0          55s

等镜像被拉下来就是 running 了。

➜  k8s kubectl get pods 
NAME        READY   STATUS    RESTARTS   AGE
mwish-bot   1/1     Running   0          6m2s

(这个时候 docker ps 竟然没有,不科学?)

然后可以看 log:

mwish-bot   1/1     Running   0          6m2s
➜  k8s kubectl logs mwish-bot
1:C 08 Feb 2020 19:17:28.146 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 08 Feb 2020 19:17:28.146 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 08 Feb 2020 19:17:28.146 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 08 Feb 2020 19:17:28.153 * Running mode=standalone, port=6379.
1:M 08 Feb 2020 19:17:28.153 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 08 Feb 2020 19:17:28.154 # Serv
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值