restartPolicy issue

William A Wang 236 Reputation points
2021-04-21T09:23:42.79+00:00

I have a app wanna deploy to AKS, it usually occur some error then the pod gonna restart, so I modify the yaml, here it is.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: testapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: testapp
  template:
    metadata:
      labels:
        app: testapp
    spec:
      nodeSelector:
        "beta.kubernetes.io/os": linux
      containers:
      - name: testapp
        image: mycr.azurecr.io/testapp:20210420
        command: ["/opt/testapp/bin/run"]
        ports:
        - containerPort: 8080
          name: testapp
      restartPolicy: Never

But when I submit the yaml it declined with such things: Failed to create the deployment 'testapp'. Error: Invalid (422) : Deployment.apps "testapp" is invalid: spec.template.spec.restartPolicy: Unsupported value: "Never": supported values: "Always"

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
384 questions
Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,854 questions
{count} votes

Accepted answer
  1. prmanhas-MSFT 17,886 Reputation points Microsoft Employee
    2021-04-22T11:54:47.487+00:00

    @William A Wang Apologies for the delay in response and all the inconvenience caused because of the issue.

    Here is a similar issue reported and as per the solution:

    It appears that only "Always" is supported.

    Please see https://github.com/kubernetes/kubernetes/issues/24725

    Hope it helps!!!

    Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics.

    0 comments No comments

0 additional answers

Sort by: Most helpful