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
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:
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
status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|
repetition number in this series | 0 | memorised on | scheduled repetition | ||||
scheduled repetition interval | last repetition or drill |