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"
@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

@ejbest
Copy link

ejbest commented Aug 18, 2024

Thanks I will try this and here is what I get

env | grep dr
drc=--dry-run=client -o yaml
drs=--dry-run=server -o yaml
dr=--dry-run -o yaml

k run nginx3 --image=nginx --port=80 $dr
error: unknown flag: --dry-run -o yaml

See 'kubectl run --help' for usage.
➜ ~ k run nginx3 --image=nginx --port=80 --dry-run -o yaml

W0818 19:32:49.776259 16467 helpers.go:703] --dry-run is deprecated and can be replaced with --dry-run=client.
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx3
name: nginx3
spec:
containers:

  • image: nginx
    name: nginx3
    ports:
    • containerPort: 80
      resources: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      status: {}
      ➜ ~

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