在 EKS 上获取 JOB_COMPLETION_INDEX
我是 Kubernetes 和 AWS 的新手,我遇到了一个问题。我正在尝试在 EKS 集群上运行并行 Kubernetes 作业。如何获取环境变量 JOB_COMPLETION_INDEX? 我之前用 Minikube“本地”测试过我的 Java 代码,一切正常。但是当我切换到 EKS 集群时,System.getenv("JOB_COMPLETION_INDEX") = null。我缺少什么?我做错了什么?
我使用 EKS 版本 1.21.2。
apiVersion: batch/v1
kind: Job
metadata:
name: calculator
labels:
jobgroup: calculator
spec:
parallelism: 2
completions: 4
completionMode: Indexed
template:
metadata:
name: calculator
spec:
containers:
- name: calculater
image: fbaensch/calculator_test:latest
imagePullPolicy: Always
restartPolicy: Never
I am new to Kubernetes and AWS and I have a problem. I am trying to run parallel Kubernetes jobs on an EKS cluster. How can I get the environment variable JOB_COMPLETION_INDEX?
I have tested my Java code before with Minikube "locally", there everything works fine. But when I switch to the EKS cluster, System.getenv("JOB_COMPLETION_INDEX") = null. What am I missing? What am I doing wrong?
I used EKS version 1.21.2.
apiVersion: batch/v1
kind: Job
metadata:
name: calculator
labels:
jobgroup: calculator
spec:
parallelism: 2
completions: 4
completionMode: Indexed
template:
metadata:
name: calculator
spec:
containers:
- name: calculater
image: fbaensch/calculator_test:latest
imagePullPolicy: Always
restartPolicy: Never
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是 v1.22 测试版功能,目前在 EKS v1.21.x 上不可用。
This is a v1.22 beta feature which currently not available on EKS v1.21.x.
EKS 不支持版本 1.22、https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html
此功能仅在 1.22 K8s 版本中可用
您可以检查问题状态位于:https://github.com/aws/containers-roadmap/issues/1397< /a>
K8s 文档:https://kubernetes.io/blog/2021/04/19/introducing-indexed-jobs/
如果您只想在 K8s 上尝试,我建议您查看 GKE 。
GKE Rapid 渠道同时拥有 1.22 和 1.22 版本。 1.23 发布选项。
GKE Rapid 渠道发行说明:https://cloud.google.com/kubernetes-engine/docs/release-notes-rapid" rel="nofollow noreferrer">https:// /cloud.google.com/kubernetes-engine/docs/release-notes-rapid
EKS don't support release 1.22, https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html
This feature only available in 1.22 K8s release
You can check issue status at : https://github.com/aws/containers-roadmap/issues/1397
K8s document : https://kubernetes.io/blog/2021/04/19/introducing-indexed-jobs/
If you just want to try it on K8s, i would suggest checking out the GKE.
GKE Rapid channel has both 1.22 & 1.23 release option.
GKE Rapid channel release notes : https://cloud.google.com/kubernetes-engine/docs/release-notes-rapid