Kubernetes 准备就绪,但仅在开始时
在K8中,我们有活力和准备。两者都在整个应用程序生命周期中运行。但这对我来说还不够。我想运行一些运行状况检查,但仅在启动时运行,或者将就绪配置为仅在启动时运行。可能吗?看一看,根据您正在执行的健康检查探测的类型,处理程序事件会有所不同。我在一个简单的hello world播客上试过这个。在postStart事件中设置一个命令,当容器构建并运行时,该命令将只运行一次。我的示例yaml文件如下所示:Kubernetes 准备就绪,但仅在开始时,kubernetes,Kubernetes,在K8中,我们有活力和准备。两者都在整个应用程序生命周期中运行。但这对我来说还不够。我想运行一些运行状况检查,但仅在启动时运行,或者将就绪配置为仅在启动时运行。可能吗?看一看,根据您正在执行的健康检查探测的类型,处理程序事件会有所不同。我在一个简单的hello world播客上试过这个。在postStart事件中设置一个命令,当容器构建并运行时,该命令将只运行一次。我的示例yaml文件如下所示: apiVersion: apps/v1 kind: Deployment metadata: n
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
labels:
app: hello-world
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- image: paulbouwer/hello-kubernetes:1.5
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]
name: hello-world
ports:
- containerPort: 8080
name: http