Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 7 Current »

Expose the port of the service

Linux shell command

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

Windows 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

Linux shell command

curl $(minikube ip):$NODE_PORT

Windows shell command

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


View the content of a deployment

shell command

kubectl describe deployment


View the content of a single pod

shell command

kubectl get pods -l run=kubernetes-bootcamp


View the content of a single service

shell command

kubectl get services -l run=kubernetes-bootcamp


Get the name of the POD

Linux shell command

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

Windows shell command

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


Change a label within a POD

Linux shell command

kubectl label pod $POD_NAME app=v1


Windows shell command

kubectl label pod $Env:POD_NAME app=v1

Describe POD using pod name

Linux shell command

kubectl describe pods $POD_NAME

Windows 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


Linux shell command

curl $(minikube ip):$NODE_PORT

Windows shell command

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

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

Linux shell command

kubectl exec -ti $POD_NAME curl localhost:8080

Windows shell command

kubectl exec -ti $Env:POD_NAME curl localhost:8080
  • No labels