kubernetes 我想在deployment.yaml文件中使用命令和args部分,而不是dockerfile中的Entrypoint

n1bvdmb6  于 2024-01-06  发布在  Kubernetes
关注(0)|答案(1)|浏览(167)

我想通过使用deployment.yaml中的命令和参数来替换dockerfile中的entrypoint“

ENTRYPOINT source /vault/secrets/keystoreinfo && exec java -Djava.security.egd=file:/dev /.urandum -jar /app.jar

字符串
问题是如何将source命令与java命令一起使用。
deployment.yaml

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
  labels:
    app: xyz
spec:
  replicas: 3
  selector:
    matchLabels:
      app: xyz
  template:
    metadata:
      labels:
        app: xyz
    spec:
      containers:
      - name: somename
        image: image
        command: ["java"]
        args: ["-Djava.security.egd=file:/dev /.urandum" , "-jar", "/app.jar"
        ports:
        - containerPort: 80

z9smfwbn

z9smfwbn1#

你应该使用shell作为入口点,例如:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
  labels:
    app: xyz
spec:
  replicas: 3
  selector:
    matchLabels:
      app: xyz
  template:
    metadata:
      labels:
        app: xyz
    spec:
      containers:
      - name: somename
        image: image
        command: ["sh"]
        args: ["-c" , "source /vault/secrets/keystoreinfo && exec java -Djava.security.egd=file:/dev /.urandum -jar /app.jar"]
        ports:
        - containerPort: 80

字符串

相关问题