Demo - Minikube : Error from server

hi @KodeKloud

In course Kubernetes for the absolute beginners - hands On course
Module : Set up Kubernetes
Option 1 : Demo Minikube

As per the instructions I have downloaded the latest version of Oracle Virtual Box v 6.1 and launched it.
Downloaded the latest kubectl.exe and minikube-amd64-windows files from the website and installed them successfully as instructed.

I can see the pod is launched but not able to expose the serivice. Below is the output
Can you please help why is this issue and how to fix it ?

I can launch the dashboard and can see the dashboard in webpage of the localhost but not able to expose the service for the pod which is running.

====================================================

c:\kubernetes>
c:\kubernetes>kubectl get pod
NAME READY STATUS RESTARTS AGE
hello-minikube 1/1 Running 0 94s

c:\kubernetes>
c:\kubernetes>kubectl expose deployment hello-minikube --type=NodePort
Error from server (NotFound): deployments.apps “hello-minikube” not found

c:\kubernetes>kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-minikube 1/1 Running 0 4m14s

c:\kubernetes>kubectl expose deployment hello-minikube --type=Nodeport
Error from server (NotFound): deployments.apps “hello-minikube” not found
c:\kubernetes>kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 32m v1.18.3

c:\kubernetes>
c:\kubernetes>kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-minikube 1/1 Running 0 21m

c:\kubernetes>
c:\kubernetes>version
‘version’ is not recognized as an internal or external command,
operable program or batch file.

c:\kubernetes>minikube version
minikube version: v1.11.0
commit: 57e2f55f47effe9ce396cea42a1e0eb4f611ebbd

c:\kubernetes>kubectl version
Client Version: version.Info{Major:“1”, Minor:“18”, GitVersion:“v1.18.0”, GitCommit:“9e991415386e4cf155a24b1da15becaa390438d8”, GitTreeState:“clean”, BuildDate:“2020-03-25T14:58:59Z”, GoVersion:“go1.13.8”, Compiler:“gc”, Platform:“windows/amd64”}
Server Version: version.Info{Major:“1”, Minor:“18”, GitVersion:“v1.18.3”, GitCommit:“2e7996e3e2712684bc73f0dec0200d64eec7fe40”, GitTreeState:“clean”, BuildDate:“2020-05-20T12:43:34Z”, GoVersion:“go1.13.9”, Compiler:“gc”, Platform:“linux/amd64”}

c:\kubernetes>date
The current date is: 30/06/2020
Enter the new date: (dd-mm-yy)

c:\kubernetes>

c:\kubernetes>
c:\kubernetes>minikube dashboard

I can see the dasboard properly but I can not expose the service for hello-minikube pod

===============================================================

I would like to know that you have deployed Pod or Deployment?
To get the list of deployment. Run the following command:
kubectl get deployment
If deployment is not there then try to add pod instead of deployment
kubectl expose pod hello-minikube --type NodePort --port port-number

Hi @ppnehe,

kubectl run no longer creates a deployment, it creates a pod as the instructions are slightly different now so it seems that you have created a pod, not deployment , check the below example to know the updated instructions :

1.RUN kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10

2.RUN kubectl expose deployment hello-minikube --type=NodePort --port=8080

3.RUN minikube service hello-minikube --url

Hope this helps!

hi @KodeKloud

Thank you for your quick support and resolution.
Yes I tried this just now and this is now working.

========================================

c:\kubernetes>
c:\kubernetes>
c:\kubernetes>kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
deployment.apps/hello-minikube created

c:\kubernetes>kubectl expose deployment hello-minikube --type=NodePort --port=8080
service/hello-minikube exposed

c:\kubernetes>minikube service hello-minikube --url
http://192.168.99.103:31786

I am able to see this in browser too with above URL and port.

=============================================

@mmumshad

Sir ,

Please revisit this video. You might want to update content of this.
As it appears this is now not exactly the same as it was there at the time of making the video.

Kubernetes for the absolute beginners - hands On course
Module : Set up Kubernetes
Option 1 : Demo Minikube

with best regards
Pradeep Nehe