是否有可能通过从 Init 容器执行的 Python 脚本失败/终止 Pod 创建?
初始化容器:
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
labels:
app.kubernetes.io/name: MyApp
spec:
containers:
- name: myapp-container
image: busybox:1.28
command: ['sh', '-c', 'echo The app is running! && sleep 3600']
initContainers:
- name: init-myservice
image: busybox:1.28
command: ["python3", "/scripts/example.py"]
示例.py
What would this Python script contain?
谢谢!
从 Python 脚本失败/终止 pod 创建
尝试:
command: ["python3", "-c", "import sys; sys.exit(1)"]