2022-02-08:k8s安装centos,yaml如何写? 注意:如果不配置参数,centos容器会处于terminated状态。如何让容器处于running状态?

2022-02-08:k8s安装centos,yaml如何写?
注意:如果不配置参数,centos容器会处于terminated状态。如何让容器处于running状态?

答案2022-02-08:

加上命令行参数即可。

yaml如下:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: centos
  name: centos
  namespace: moonfdd
spec:
  replicas: 1
  selector:
    matchLabels:
      app: centos
  template:
    metadata:
      labels:
        app: centos
    spec:
      containers:
        - args:
            - while true; do sleep 30; done;
          command:
            - /bin/bash
            - '-c'
            - '--'
          image: centos:centos7.9.2009
          imagePullPolicy: IfNotPresent
          name: centos
          securityContext:
            privileged: true

结果如下:
2022-02-08:k8s安装centos,yaml如何写? 注意:如果不配置参数,centos容器会处于terminated状态。如何让容器处于running状态?


centos的yaml

上一篇:centos7 centos-home 磁盘空间转移至centos-root下


下一篇:flowable:couldn't upgrade db schemak