Hello-minikube deployment

Create a hello-minikube deployment and expose it on port 8080 by create and expose command.

kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment hello-minikube --type=NodePort --port=8080
  • the hello-minikube-xxxx deployment, service and pod will created
  • the service type is nodeport
  • the namespace is default

Verify the deployment is created

kubectl get deployment -o wide -n default
# NAME             READY   UP-TO-DATE   AVAILABLE   AGE   CONTAINERS   IMAGES                      SELECTOR
# hello-minikube   1/1     1            1           10m   echoserver   k8s.gcr.io/echoserver:1.4   app=hello-minikube
  • Without -n default: namespace, the default namespcae is default.

Verify the service is created

$ kubectl get service -o wide -n default
NAME             TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE     SELECTOR
hello-minikube   NodePort    10.105.87.96   <none>        8080:30624/TCP   9m46s   app=hello-minikube
kubernetes       ClusterIP   10.96.0.1      <none>        443/TCP          44m     <none>
  • Without -n default: namespace, the default namespcae is default.

Verify the pod is created

kubectl get pod -o wide -n default
# NAME                              READY   STATUS    RESTARTS   AGE     IP           NODE       NOMINATED NODE   READINESS GATES
# hello-minikube-6ddfcc9757-kvxcl   1/1     Running   0          8m47s   172.17.0.3   minikube   <none>           <none>
  • Without -n default: namespace, the default namespcae is default.

Get the URL of the expose serivce

minikube service hello-minikube --url
# http://192.168.49.2:30624

Open browser for checking the application is working.

Delete service, deployment and pod

kubectl delete service hello-minikube -n default
# service "hello-minikube" deleted

kubectl delete deployment hello-minikube -n default
# deployment.apps "hello-minikube" deleted

When you delete deployment the pod will be terminated and deleted.

Stop Minikube

minikube stop

https://minikube.sigs.k8s.io/docs/start/

Leave a Reply

Your email address will not be published.

ANOTE.DEV