Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Expose the port of the service

Info
titleLinux shell command

export NODE_PORT=$(kubectl get services/kubernetes-bootcamp -o go-template='{{(index .spec.ports 0).nodePort}}')

...

Info
titleWindows shell command

$Env:NODE_PORT=$(kubectl get services/kubernetes-bootcamp -o go-template='{{(index .spec.ports 0).nodePort}}')

Use curl the view a response from the service

Info
titleLinux shell command

curl $(minikube ip):$NODE_PORT

...

Info
titleWindows shell command

curl "$(minikube ip):$Env:NODE_PORT"


View the content of a deployment

Info
titleshell command
kubectl describe deployment


View the content of a single pod

Info
titleshell command
kubectl get pods -l run=kubernetes-bootcamp


View the content of a single service

Info
titleshell command
kubectl get services -l run=kubernetes-bootcamp


Get the name of the POD

Info
titleLinux shell command
export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')

...

Info
titleWindows shell command
$Env:POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{end}}')

Seeing all information on a service

Info
titleWindows shell command

kubectl get all

Seeing detailed information about a deployment

Info
titleWindows shell command

kubectl get deploy/<service name> -o yaml


Change a label within a POD

Info
titleLinux shell command
kubectl label pod $POD_NAME app=v1

...

Info
titleWindows shell command

kubectl label pod $Env:POD_NAME app=v1

Describe POD using pod name

Info
titleLinux shell command
kubectl describe pods $POD_NAME

...

Info
titleWindows shell command
kubectl describe pods $Env:POD_NAME

Using value of POD get a particular POD

kubectl get pods -l app=v1


Delete a service

kubectl delete service -l run=kubernetes-bootcamp


Confirm service has been deleted

kubectl get services

The next command proves that the app is not reachable from the outside


Info
titleLinux shell command

curl $(minikube ip):$NODE_PORT

...

Info
titleWindows shell command
curl "$(minikube ip):$Env:NODE_PORT"

The next command proves that the app is still up and running

Info
titleLinux shell command
kubectl exec -ti $POD_NAME curl localhost:8080

...