Score:0

kubectl error: cannot add key dashboard.yaml, another key by that name already exists

cn flag

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

Score:1
cn flag

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)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.