Opening a new shell or tab gives the following output: awk: can't open file /Users/chad.greenburg/.kube/config. I don't have anything related to kubecontext installed or whatever that refers to. Probably need to handle this error gracefully if the file doesn't exist.

Operating system: macOS
Terminal emulator: iTerm
ZSH version: 5.4.2
I solved this problem by creating .kube/config folders.
I think it should look more like this:
# KUBECONTEXT
# Show current context in kubectl.
spaceship_kubecontext() {
[[ $SPACESHIP_KUBECONTEXT_SHOW == false ]] && return
# Show KUBECONTEXT status only for folders with .kube and file config inside.
[[ -f .kube/config ]] || return
local kube_context=$(awk -F' *: *' '$1 == "current-context" {print $2}' ~/.kube/config)
_prompt_section \
"$SPACESHIP_KUBECONTEXT_COLOR" \
"$SPACESHIP_KUBECONTEXT_PREFIX" \
"${SPACESHIP_KUBECONTEXT_SYMBOL}${kube_context}" \
"$SPACESHIP_KUBECONTEXT_SUFFIX"
}
Only problem with @Trioblack's solutions is that now the command line always has a Snowflake emoji.
Minor, but still an annoyance.
the same on Ubuntu into Windows 10
The irritation grew unbearable for me, so I worked around it this way:
Add the following to your ~/.oh-my-zsh/custom/themes/spaceship.zsh-theme:
SPACESHIP_KUBECONTEXT_SHOW="${SPACESHIP_KUBECONTEXT_SHOW:=false}"
Then, reload shell.
Disabling kubecontext section (as @tohuw suggested) might be a solution until PR with a fix will be ready. However, better to add this custom configuration to .zshrc, instead of spaceship.zsh-theme.
Another solution if anyone is already editing their prompt order.
The snowflake and error leave after removing kubecontext from SPACESHIP_PROMPT_ORDER. The following is the readme's example order with kubecontext commented out. Add after the theme's source line in .zshrc
# ORDER
SPACESHIP_PROMPT_ORDER=(
time
user
host
dir
git
hg
package
node
ruby
elixir
xcode
swift
golang
php
rust
julia
docker
aws
venv
conda
pyenv
dotnet
ember
# kubecontext
battery
exec_time
line_sep
vi_mode
jobs
exit_code
char
)
Best approach is memoryruins answer. If you have no interest in using kubernetes and/or don't have it installed, then this is the quick and easy solution until a patch is pulled into master.
Fixed. Please update to v2.10.2.
We've fixed annoying 馃殌猸愶笍Spaceship ZSH bug with kubecontext.
— Denys Dovhan (@denysdovhan) October 19, 2017
Please, update to v2.10.2 if you have such problems: https://t.co/M6jfJbNjr1
Most helpful comment
Another solution if anyone is already editing their prompt order.
The snowflake and error leave after removing
kubecontextfromSPACESHIP_PROMPT_ORDER. The following is the readme's example order withkubecontextcommented out. Add after the theme's source line in.zshrc