Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



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


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

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.