Skip to content

"kube-apiserver" does not take any extra arguments #5

@hh

Description

@hh

Ran into an issue when initially adding api server args:

Error: "kube-apiserver" does not take any arguments,
 got [
  "map[audit-policy-file:/etc/kubernetes/audit/policy.yaml]"
  "map[audit-webhook-config-file:/etc/kubernetes/audit/sink.yaml]"
  ]

So I looked closer at the deployment and args to kube-apiserver

kubectl -n hh get deployment/k8s-wed1110-api  -o yaml | yq .spec.template.spec.containers.0.command | grep map
- map[audit-policy-file:/etc/kubernetes/audit/policy.yaml]
- map[audit-webhook-config-file:/etc/kubernetes/audit/sink.yaml]

If we look closer at how that deployment is rendered: In https://github.com/loft-sh/vcluster/blob/main/charts/k8s/templates/api-deployment.yaml#L143-L145

It’s looping over each api.extraArgs string value:

   {{- range $f := .Values.api.extraArgs }}
    - {{ $f | quote }}
   {{- end }}

We were providing map types:

extraArgs:
  - "audit-policy-file": "/etc/kubernetes/audit/policy.yaml"
  - "audit-webhook-config-file: "/etc/kubernetes/audit/sink.yaml"

Instead of a list of strings:

extraArgs:
 - "--audit-policy-file=/etc/kubernetes/audit/policy.yaml"
 - "--audit-webhook-config-file=/etc/kubernetes/audit/sink.yaml"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions