Question

In kubernetes, let say you do a 3 pod deployment called "kubernetes-bootcamp" using docker image "gcr.io/google-samples/kubernetes-bootcamp:v1" as follows:

kubectl run kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 --port=8080 --replicas=3

Run command to get these pods to be accessible from a dynamic port on the host machine:

kubectl expose deployment kubernetes-bootcamp --type=NodePort --port=8080

^^ the key point here is knowing the "kubectl expose" command and how to use it

^^^ note above command creates a service (also called "kubernetes-bootcamp"), which allows the pods to be exposed via a dynamic port, e.g. via: "curl $(hostname):30993", where 30993 is the dynamic port generated. ^^^^ note the --type param is set to NodePort, which will expose the nodes via a dynamiclly generated port, so you can access from the node/host you are running kubectl from. There are other more advanced/better --type options, refer to the k8s docs Question In kubernetes, let say you do a 3 pod deployment called "kubernetes-bootcamp" using docker image "gcr.io/google-samples/kubernetes-bootcamp:v1" as follows: kubectl run kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 --port=8080 --replicas=3 Run command to get these pods to be accessible from a dynamic port on the host machine: Answer ? Question In kubernetes, let say you do a 3 pod deployment called "kubernetes-bootcamp" using docker image "gcr.io/google-samples/kubernetes-bootcamp:v1" as follows: kubectl run kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 --port=8080 --replicas=3 Run command to get these pods to be accessible from a dynamic port on the host machine: Answer kubectl expose deployment kubernetes-bootcamp --type=NodePort --port=8080 ^^ the key point here is knowing the "kubectl expose" command and how to use it ^^^ note above command creates a service (also called "kubernetes-bootcamp"), which allows the pods to be exposed via a dynamic port, e.g. via: "curl$(hostname):30993", where 30993 is the dynamic port generated.

^^^^ note the --type param is set to NodePort, which will expose the nodes via a dynamiclly generated port, so you can access from the node/host you are running kubectl from. There are other more advanced/better --type options, refer to the k8s docs

#### Summary

status measured difficulty not learned 37% [default] 0

No repetitions