0

Our system architect left and I'm thrown into a deep water managing Kubernetes cluster. I'm trying to update ssl-secret on our kubernetes cluster, using the following command

kubectl -n zone-system create secret generic ssl-secret \
        --from-file=./$CERT_FILE \
        --from-file=./$KEY_FILE \
        --dry-run=client \
        -o yaml |
         kubectl apply -f -

When I run it, however, I get the following error:

error: cannot add key dashboard.yaml, another key by that name already exists
error: no objects passed to apply

I'm not sure how to resolve it. Tried Google and Stackoverflow searches, but none of the questions are actually related to this error. I know the second error is due to the first one.

Thanks ahead,

Igal

igalsc
  • 11
  • 4

1 Answers1

1

The question answered user P.... on Stack Overflow I will post it here, just in case someone needs it.

The $CERT_FILE and $KEY_FILE variables are used in the setup.sh in the same directory I run the script to update the certificates. These were not set as system variables, thus both returned empty value. Since I already have the dashboard.yaml in the same directory, thus I received the error. (original answer here https://stackoverflow.com/questions/67893285/kubectl-error-cannot-add-key-dashboard-yaml-another-key-by-that-name-already-e)

igalsc
  • 11
  • 4