book-of-kubernetes / examples

Examples for The Book of Kubernetes
MIT License
146 stars 71 forks source link

kubectl config file missing #25

Open rpjeff opened 1 year ago

rpjeff commented 1 year ago

The example is from Chapter 10 but affects other chapters.

# kubectl apply -f /opt/nginx-selector.yaml 
The connection to the server localhost:8080 was refused - did you specify the right host or port?

The fix is to copy main config file

# cp /etc/kubernetes/admin.conf ~/.kube/config

It then succeeds,

# kubectl apply -f /opt/nginx-selector.yaml 
pod/nginx created