Projects:Kubernetes: verschil tussen versies

Naar navigatie springen Naar zoeken springen
148 bytes toegevoegd ,  16 mrt 2019
geen bewerkingssamenvatting
Geen bewerkingssamenvatting
Geen bewerkingssamenvatting
Regel 411: Regel 411:
Now, we'd like to see nginx in action! The pod is listening on an internal port 80 (according to its configuration and the default nginx config). If we want to access this from outside the cluster, there's three ways:
Now, we'd like to see nginx in action! The pod is listening on an internal port 80 (according to its configuration and the default nginx config). If we want to access this from outside the cluster, there's three ways:


* <code>kubectl port-forward</code>, which listens to a local port on the machine where you run <code>kubectl port-forward</code>, and then forwards all connections to a deployment or a pod. (I've explained above how to configure kubectl so it can run on your own machine when the cluster runs elsewhere.)
* <code>kubectl port-forward</code>, which listens to a local port on the machine where you run <code>kubectl port-forward</code>, and then forwards all connections to a pod. (I've explained above how to configure kubectl so it can run on your own machine when the cluster runs elsewhere.)
* Creating a Service
* Creating a Service
* Creating an Ingress
* Creating an Ingress
Regel 425: Regel 425:
Now, visit <code>http://127.0.0.1:8080</code> in your browser and presto!
Now, visit <code>http://127.0.0.1:8080</code> in your browser and presto!


This, of course, will no longer work when this pod stops working, so normally we'd always do a port-forward to a deployment:
You can also do a port-forward to a deployment:


<pre>
<pre>
Regel 433: Regel 433:
</pre>
</pre>


Now, when you visit <code>http://127.0.0.1:8080</code>, you'll get a response from ''either'' of the two pods. If one of them is down, you'll get it from the one that's up. If both are down, you're out of luck...
When you start a port-forward to a deployment, the deployment is resolved to a random one of the <code>Running</code> pods in the deployment. So, in this case, you'll get a response from ''either'' of the two pods; if one of them is down, you'll get it from the one that's up. (If both are down, you're out of luck.) However, when that resolved pod goes down for whatever reason, the port-forward is '''not''' restarted to another pod in the deployment.


= Creating your own pods =
= Creating your own pods =

Navigatiemenu