Skip to content

Instantly share code, notes, and snippets.

@JamieMac96
Created January 1, 2023 21:02
Show Gist options
  • Save JamieMac96/adf9d3c9fe9aa6cd40a20047efabc9ec to your computer and use it in GitHub Desktop.
Save JamieMac96/adf9d3c9fe9aa6cd40a20047efabc9ec to your computer and use it in GitHub Desktop.
CKA-Bashrc
alias k="kubectl"
alias v="vim"
function ns () {
kubectl config set-context --current --namespace=$1
}
export drc="--dry-run=client -oyaml"
export drs="--dry-run=server -oyaml"
@ZiaUrRehman786
Copy link

When I run

echo $drc

it print out this
--dry-run=client -o yaml
but When I run

k run nginx --image=nginx $drc

It throw an error
error: Invalid dry-run value (client -o yaml). Must be "none", "server", or "client".
Note: I'm doing all this on Mac M1 Chip with zsh using ~/.bashrc

@JamieMac96
Copy link
Author

Hey Zia, yes variable expansion in zsh behaves a little bit differently to how it behaves in bash. This post explains how you can workaround: https://stackoverflow.com/questions/6715388/variable-expansion-is-different-in-zsh-from-that-in-bash

In the exam the shell will always be bash so you won't need to worry about this problem.

@kk-mm
Copy link

kk-mm commented Mar 4, 2023

hello @ZiaUrRehman786,
did you try "-oyaml" but not "-o yaml" ?

@ZiaUrRehman786
Copy link

@kk-mm I tried both and in zsh. nothing work for me. no problem because in cka exam the will be sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment