zoukankan      html  css  js  c++  java
  • 【k8s】Container-stdin

    环境

    1. kubernetes 1.20.4
    2. Spring Boot 2.5.0-M3

    目标

    容器的 stdin 字段表示是否需要给容器分配一个标准输入。

    示例

    Pod.yaml

    apiVersion: v1
    kind: Pod
    metadata:
      name: busybox
    spec:
      containers:
        - name: busybox
          image: busybox:stable
          stdin: true
          command: ["/bin/sh"]
    

    查看 Pod

    NAME      READY   STATUS    RESTARTS   AGE
    busybox   1/1     Running   0          4m9s
    

    进入容器

    [root@master kubernetes]# kubectl attach --stdin busybox
    Defaulting container name to busybox.
    Use 'kubectl describe pod/busybox -n default' to see all of the containers in this pod.
    If you don't see a command prompt, try pressing enter.
    ls
    bin
    dev
    etc
    home
    proc
    root
    sys
    tmp
    usr
    var
    

    总结

    容器的 stdin 字段可以给容器分配一个标准输入。

    附录

  • 相关阅读:
    字符串的操作
    前端
    HTML标签
    模块与包
    常用模块
    函数进阶
    函数初识
    文件操作
    集合及深浅拷贝
    python中的一些编码问题
  • 原文地址:https://www.cnblogs.com/jiangbo44/p/14585783.html
Copyright © 2011-2022 走看看