Deploy GitHub Pages

This commit is contained in:
k8s-ci-robot 2022-06-03 09:45:25 +00:00
parent 4c405659d2
commit 3cee7b6d59
4 changed files with 53 additions and 53 deletions

View file

@ -10,7 +10,7 @@
</code></pre></div> <h3 id=local-testing>Local testing<a class=headerlink href=#local-testing title="Permanent link"></a></h3> <p>Let's create a simple web server and the associated service:</p> <div class=highlight><pre><span></span><code><span class=go>kubectl create deployment demo --image=httpd --port=80</span>
<span class=go>kubectl expose deployment demo</span>
</code></pre></div> <p>Then create an ingress resource. The following example uses an host that maps to <code>localhost</code>:</p> <div class=highlight><pre><span></span><code><span class=go>kubectl create ingress demo-localhost --class=nginx \</span>
<span class=go> --rule=demo.localdev.me/*=demo:80</span>
<span class=go> --rule=&quot;demo.localdev.me/*=demo:80&quot;</span>
</code></pre></div> <p>Now, forward a local port to the ingress controller:</p> <div class=highlight><pre><span></span><code><span class=go>kubectl port-forward --namespace=ingress-nginx service/ingress-nginx-controller 8080:80</span>
</code></pre></div> <p>At this point, if you access http://demo.localdev.me:8080/, you should see an HTML page telling you "It works!".</p> <h3 id=online-testing>Online testing<a class=headerlink href=#online-testing title="Permanent link"></a></h3> <p>If your Kubernetes cluster is a "real" cluster that supports services of type <code>LoadBalancer</code>, it will have allocated an external IP address or FQDN to the ingress controller.</p> <p>You can see that IP address or FQDN with the following command:</p> <div class=highlight><pre><span></span><code><span class=go>kubectl get service ingress-nginx-controller --namespace=ingress-nginx</span>
</code></pre></div> <p>It will be the <code>EXTERNAL-IP</code> field. If that field shows <code>&lt;pending&gt;</code>, this means that your Kubernetes cluster wasn't able to provision the load balancer (generally, this is because it doesn't support services of type <code>LoadBalancer</code>).</p> <p>Once you have the external IP address (or FQDN), set up a DNS record pointing to it. Then you can create an ingress resource. The following example assumes that you have set up a DNS record for <code>www.demo.io</code>:</p> <div class=highlight><pre><span></span><code><span class=go>kubectl create ingress demo --class=nginx \</span>