2 Answers
Hi Adam. Glad you’re liking the course so far. A bit naughty of you skipping the intro stuff though 😉
Just kidding. With the info provided there are two or three things that spring to mind…
1. The imperative command that you are using kubectl expose deployment hello-svc --type=loadbalancer
appears to be trying to expose a Deployment called "hello-svc". In my examples, "hello-svc" is a Service, not a Deployment. If using my examples, the command should probably be kubectl expose deployment hello-deploy --type=loadbalancer
.
2. Another thing that jumps out is that you cannot define a LoadBalancer Service on minikube. They only work on cloud platforms such as AWS, Azure, and GCP.
3. What version of Kubernetes are you running on your minikube cluster?
$ kubectl version -o yaml
should show you.
If you’re running an older version, the error might be because the YAML file in the repo is defining the Deployment object from the app/v1
API group. Older versions of Kubernetes (prior to 1.9 I think) defined Deployments in the extensions API group. E.g. extensions/v2beta1. To get around this, you can trash your minikube cluster and build a new one with the --kubernetes-version=v1.11.2
flag to force a specific version.
Finally, you can use minikube ip
to find the address of your minikube cluster that you can then use to connect to your Services etc.
HTH
I’m using Docker For Windows. For me I could reach the service using localhost in the browser after applying the lb.yml file.
Hi Nigel, thanks so much mate – I am still struggling to view the actual service, I am trying to get it running locally without going on cloud just now. I have tried running kubectl expose deployment hello-svc without loadbalancer, then starting the service "minikube service hello-svc" but it opens the browser then says the site can’t be reached 🙁 I also tried using the minikube ip but again that won’t load