2022-02-08:k8s安装centos,yaml如何写?
注意:如果不配置参数,centos容器会处于terminated状态。如何让容器处于running状态?
答案2022-02-08:
加上命令行参数即可。
yaml如下:
代码语言: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
结果如下:
centos的yaml