Expose the port of the service
Info |
---|
|
export NODE_PORT=$(kubectl get services/kubernetes-bootcamp -o go-template='{{(index .spec.ports 0).nodePort}}') |
...
Info |
---|
title | 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
Info |
---|
|
curl $(minikube ip):$NODE_PORT |
...
Info |
---|
title | Windows shell command |
---|
|
curl "$(minikube ip):$Env:NODE_PORT" |
View the content of a deployment
Info |
---|
|
kubectl describe deployment |
View the content of a single pod
Info |
---|
|
kubectl get pods -l run=kubernetes-bootcamp |
View the content of a single service
Info |
---|
|
kubectl get services -l run=kubernetes-bootcamp |
Get the name of the POD
Info |
---|
|
export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') |
...
Info |
---|
title | Windows shell command |
---|
|
$Env:POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{end}}') |
Seeing all information on a service
Info |
---|
title | Windows shell command |
---|
|
kubectl get all |
Seeing detailed information about a deployment
Info |
---|
title | Windows shell command |
---|
|
kubectl get deploy/<service name> -o yaml |
Change a label within a POD
Info |
---|
|
kubectl label pod $POD_NAME app=v1 |
...
Info |
---|
title | Windows shell command |
---|
|
kubectl label pod $Env:POD_NAME app=v1 |
Describe POD using pod name
Info |
---|
|
kubectl describe pods $POD_NAME |
...
Info |
---|
title | 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
Info |
---|
|
curl $(minikube ip):$NODE_PORT |
...
Info |
---|
title | Windows shell command |
---|
|
curl "$(minikube ip):$Env:NODE_PORT" |
The next command proves that the app is still up and running
Info |
---|
|
kubectl exec -ti $POD_NAME curl localhost:8080 |
...