-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
In this tutorial, this command does not work for powershell terminal when trying to create an environment variable: export NODE_PORT="$(kubectl get services/kubernetes-bootcamp -o go-template='{{(index .spec.ports 0).nodePort}}')"
The response from powershell is that "export" is not a recognised command.
Google AI suggested I start with $NODEPORT=........." (without the export command, begin with the dollar sign and the NODEPORT without underscore) and it worked and I think this should be indicated to assist powershell terminal users.
For the echo command that follows, this is what worked for powershell: echo $NODEPORT and NOT echo NODE_PORT=$NODE_PORT
For the load balancing command (curl http://"$(minikube ip):$NODE_PORT"), powershell did not load balance but kept showing response from only one pod.
Hence to see responses from different pods, Google AI suggested:
PS C:\Users\Mr Samuel> $URL = "http://192.168.59.101:$((kubectl get svc kubernetes-bootcamp -o jsonpath='{.spec.ports[0].nodePort}'))"
PS C:\Users\Mr Samuel> 1..10 | ForEach-Object { curl.exe -s $URL }
These worked well for powershell and showed minikube load balancing to different pods:
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-67fbdd6b79-7k42l | v=1
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-67fbdd6b79-rb748 | v=1
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-67fbdd6b79-rb748 | v=1
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-67fbdd6b79-nm8wr | v=1
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-67fbdd6b79-7k42l | v=1
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-67fbdd6b79-rb748 | v=1
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-67fbdd6b79-nm8wr | v=1
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-67fbdd6b79-rb748 | v=1
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-67fbdd6b79-rb748 | v=1
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-67fbdd6b79-rb748 | v=1
Thank you very much for the opportunity to join the Andela 2026 Africa Training Program and to take this course.
Regards,
Samuel
ekwosam@gmail.com