Haojie Du
Haojie Du

Reputation: 1

Create env fails when using a daemonset to create processes in Kubernetes

I want to deploy a software in to nodes with daemonset, but it is not a docker app. I created a daemonset json like this :

"template": {
      "metadata": {
        "creationTimestamp": null,
        "labels": {
          "app": "uniagent"
        },
        "annotations": {
          "scheduler.alpha.kubernetes.io/tolerations": "[{\"key\":\"beta.k8s.io/accepted-app\",\"operator\":\"Exists\", \"effect\":\"NoSchedule\"}]"
        },
        "enable": true
      },
      "spec": {
        "restartPolicy": "Always",
        "terminationGracePeriodSeconds": 30,
        "dnsPolicy": "ClusterFirst",
        "securityContext": {},
        "processes": [
          {
            "name": "foundation",
            "package": "xxxxx",
            "resources": {
              "limits": {
                "cpu": "100m",
                "memory": "1Gi"
              }
            },
            "lifecyclePlan": {
              "kind": "ProcessLifecycle",
              "namespace": "engb",
              "name": "app-plc"
            },
           "env": [
            {
              "name": "SECRET_USERNAME",
              "valueFrom": {
                "secretKeyRef": {
                  "name": "key-secret",
                  "key": "uniagentuser"
                }
              }
            },
            {
              "name": "SECRET_PASSWORD",
              "valueFrom": {
                "secretKeyRef": {
                  "name": "key-secret",
                  "key": "uniagenthash"
                }
              }
            }
          ]
          },

when the app deploy succeeds, the env variables do not exist at all.

What should I do to solve this problem? Thanks

Upvotes: 0

Views: 115

Answers (1)

ahmet alp balkan
ahmet alp balkan

Reputation: 45312

Daemon Sets have to be docker containers. You can't have non-containerized programs run as Daemon Sets. https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ Kubernetes only launches containers.

Also in your YAML manifest file, I see a "processes" key and I have reason to believe it's not a valid manifest file, so I doubt you deployed it successfully.

You have not pasted the "full" YAML file, but I'm guessing the "template" key at the beginning is the spec.template key of the file.

Run kubectl explain daemonset.spec.template.spec and you'll see that there is no "processes" field.

Upvotes: 4

Related Questions