Skip to content

Commit 3834c3d

Browse files
author
Vincent
authored
Add description on how to configure each ingress for knative serving (#3025)
* Add description on how to configure each ingress for knative serving * Rephrase the sentence in a correct order
1 parent b760e6b commit 3834c3d

File tree

1 file changed

+352
-0
lines changed

1 file changed

+352
-0
lines changed

docs/install/knative-with-operators.md

Lines changed: 352 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,358 @@ NAME VERSION READY REASON
207207
knative-serving <version number> True
208208
```
209209

210+
### Installing the Knative Serving component with different network layers
211+
212+
Knative Operator can configure Knative Serving component with different network layer options. Istio is the default network
213+
layer, if the ingress is not specified in the Knative Serving CR. Click on each tab below to see how you can configure
214+
Knative Serving with different ingresses:
215+
216+
{{< tabs name="serving_networking" default="Ambassador" >}}
217+
{{% tab name="Ambassador" %}}
218+
219+
{{% feature-state version="v0.8" state="alpha" %}}
220+
221+
The following commands install Ambassador and enable its Knative integration.
222+
223+
1. Create a namespace to install Ambassador in:
224+
225+
```bash
226+
kubectl create namespace ambassador
227+
```
228+
229+
1. Install Ambassador:
230+
231+
```bash
232+
kubectl apply --namespace ambassador \
233+
--filename https://getambassador.io/yaml/ambassador/ambassador-crds.yaml \
234+
--filename https://getambassador.io/yaml/ambassador/ambassador-rbac.yaml \
235+
--filename https://getambassador.io/yaml/ambassador/ambassador-service.yaml
236+
```
237+
238+
1. Give Ambassador the required permissions:
239+
240+
```bash
241+
kubectl patch clusterrolebinding ambassador -p '{"subjects":[{"kind": "ServiceAccount", "name": "ambassador", "namespace": "ambassador"}]}'
242+
```
243+
244+
1. Enable Knative support in Ambassador:
245+
246+
```bash
247+
kubectl set env --namespace ambassador deployments/ambassador AMBASSADOR_KNATIVE_SUPPORT=true
248+
```
249+
250+
1. To configure Knative Serving to use Ambassador, apply the content of the Serving CR as below:
251+
252+
```bash
253+
cat <<-EOF | kubectl apply -f -
254+
apiVersion: operator.knative.dev/v1alpha1
255+
kind: KnativeServing
256+
metadata:
257+
name: knative-serving
258+
namespace: knative-serving
259+
spec:
260+
config:
261+
network:
262+
ingress.class: "ambassador.ingress.networking.knative.dev"
263+
EOF
264+
```
265+
266+
1. Fetch the External IP or CNAME:
267+
268+
```bash
269+
kubectl --namespace ambassador get service ambassador
270+
```
271+
272+
Save this for configuring DNS below.
273+
274+
{{< /tab >}}
275+
276+
{{% tab name="Contour" %}}
277+
278+
{{% feature-state version="v0.18" state="stable" %}}
279+
280+
The following commands install Contour and enable its Knative integration.
281+
282+
1. Install a properly configured Contour:
283+
284+
```bash
285+
kubectl apply --filename {{< artifact repo="net-contour" file="contour.yaml" >}}
286+
```
287+
288+
1. Install the Knative Contour controller:
289+
290+
```bash
291+
kubectl apply --filename {{< artifact repo="net-contour" file="net-contour.yaml" >}}
292+
```
293+
294+
1. To configure Knative Serving to use Contour, apply the content of the Serving CR as below:
295+
296+
```bash
297+
cat <<-EOF | kubectl apply -f -
298+
apiVersion: operator.knative.dev/v1alpha1
299+
kind: KnativeServing
300+
metadata:
301+
name: knative-serving
302+
namespace: knative-serving
303+
spec:
304+
config:
305+
network:
306+
ingress.class: "contour.ingress.networking.knative.dev"
307+
EOF
308+
```
309+
310+
1. Fetch the External IP or CNAME:
311+
312+
```bash
313+
kubectl --namespace contour-external get service envoy
314+
```
315+
316+
Save this for configuring DNS below.
317+
318+
{{< /tab >}}
319+
320+
{{% tab name="Gloo" %}}
321+
322+
{{% feature-state version="v0.8" state="alpha" %}}
323+
324+
_For a detailed guide on Gloo integration, see
325+
[Installing Gloo for Knative](https://docs.solo.io/gloo/latest/installation/knative/)
326+
in the Gloo documentation._
327+
328+
The following commands install Gloo and enable its Knative integration.
329+
330+
1. Make sure `glooctl` is installed (version 1.3.x and higher recommended):
331+
332+
```bash
333+
glooctl version
334+
```
335+
336+
If it is not installed, you can install the latest version using:
337+
338+
```bash
339+
curl -sL https://run.solo.io/gloo/install | sh
340+
export PATH=$HOME/.gloo/bin:$PATH
341+
```
342+
343+
Or following the
344+
[Gloo CLI install instructions](https://docs.solo.io/gloo/latest/installation/knative/#install-command-line-tool-cli).
345+
346+
1. Install Gloo and the Knative integration:
347+
348+
```bash
349+
glooctl install knative --install-knative=false
350+
```
351+
352+
1. To configure Knative Serving to use Gloo, apply the content of the Serving CR as below:
353+
354+
```bash
355+
cat <<-EOF | kubectl apply -f -
356+
apiVersion: operator.knative.dev/v1alpha1
357+
kind: KnativeServing
358+
metadata:
359+
name: knative-serving
360+
namespace: knative-serving
361+
spec:
362+
ingress:
363+
gloo:
364+
enabled: true
365+
EOF
366+
```
367+
368+
1. Fetch the External IP or CNAME:
369+
370+
```bash
371+
glooctl proxy url --name knative-external-proxy
372+
```
373+
374+
Save this for configuring DNS below.
375+
376+
{{< /tab >}}
377+
378+
{{% tab name="Kong" %}}
379+
380+
{{% feature-state version="v0.13" state="" %}}
381+
382+
The following commands install Kong and enable its Knative integration.
383+
384+
1. Install Kong Ingress Controller:
385+
386+
```bash
387+
kubectl apply --filename https://raw.githubusercontent.com/Kong/kubernetes-ingress-controller/0.9.x/deploy/single/all-in-one-dbless.yaml
388+
```
389+
390+
1. To configure Knative Serving to use Kong, apply the content of the Serving CR as below:
391+
392+
```bash
393+
cat <<-EOF | kubectl apply -f -
394+
apiVersion: operator.knative.dev/v1alpha1
395+
kind: KnativeServing
396+
metadata:
397+
name: knative-serving
398+
namespace: knative-serving
399+
spec:
400+
config:
401+
network:
402+
ingress.class: "kong"
403+
EOF
404+
```
405+
406+
1. Fetch the External IP or CNAME:
407+
408+
```bash
409+
kubectl --namespace kong get service kong-proxy
410+
```
411+
412+
Save this for configuring DNS below.
413+
414+
{{< /tab >}}
415+
416+
{{% tab name="Kourier" %}}
417+
418+
{{% feature-state version="v0.17" state="beta" %}}
419+
420+
The following commands install Kourier and enable its Knative integration.
421+
422+
1. Install the Knative Kourier controller:
423+
424+
```bash
425+
kubectl apply --filename {{< artifact repo="net-kourier" file="kourier.yaml" >}}
426+
```
427+
428+
1. To configure Knative Serving to use Kourier, apply the content of the Serving CR as below:
429+
430+
```bash
431+
cat <<-EOF | kubectl apply -f -
432+
apiVersion: operator.knative.dev/v1alpha1
433+
kind: KnativeServing
434+
metadata:
435+
name: knative-serving
436+
namespace: knative-serving
437+
spec:
438+
config:
439+
network:
440+
ingress.class: "kourier.ingress.networking.knative.dev"
441+
EOF
442+
```
443+
444+
1. Fetch the External IP or CNAME:
445+
446+
```bash
447+
kubectl --namespace knative-serving get service kourier
448+
```
449+
450+
Save this for configuring DNS below.
451+
452+
{{< /tab >}} {{< /tabs >}}
453+
454+
1. Configure DNS
455+
456+
<!-- This indentation is important for things to render properly. -->
457+
458+
{{< tabs name="serving_dns" >}} {{% tab name="Magic DNS (xip.io)" %}} We ship
459+
a simple Kubernetes Job called "default domain" that will (see caveats)
460+
configure Knative Serving to use <a href="http://xip.io">xip.io</a> as the
461+
default DNS suffix.
462+
463+
```bash
464+
kubectl apply --filename {{< artifact repo="serving" file="serving-default-domain.yaml" >}}
465+
```
466+
467+
**Caveat**: This will only work if the cluster LoadBalancer service exposes an
468+
IPv4 address or hostname, so it will not work with IPv6 clusters or local setups
469+
like Minikube. For these, see "Real DNS" or "Temporary DNS". {{< /tab >}}
470+
471+
{{% tab name="Real DNS" %}} To configure DNS for Knative, take the External IP
472+
or CNAME from setting up networking, and configure it with your DNS provider as
473+
follows:
474+
475+
- If the networking layer produced an External IP address, then configure a
476+
wildcard `A` record for the domain:
477+
478+
```
479+
# Here knative.example.com is the domain suffix for your cluster
480+
*.knative.example.com == A 35.233.41.212
481+
```
482+
483+
- If the networking layer produced a CNAME, then configure a CNAME record for
484+
the domain:
485+
486+
```
487+
# Here knative.example.com is the domain suffix for your cluster
488+
*.knative.example.com == CNAME a317a278525d111e89f272a164fd35fb-1510370581.eu-central-1.elb.amazonaws.com
489+
```
490+
491+
Once your DNS provider has been configured, add the following section into your existing Serving CR, and apply it:
492+
493+
```bash
494+
# Replace knative.example.com with your domain suffix
495+
apiVersion: operator.knative.dev/v1alpha1
496+
kind: KnativeServing
497+
metadata:
498+
name: knative-serving
499+
namespace: knative-serving
500+
spec:
501+
config:
502+
domain:
503+
"knative.example.com": ""
504+
...
505+
```
506+
507+
{{< /tab >}}
508+
509+
{{% tab name="Temporary DNS" %}} If you are using `curl` to access the sample
510+
applications, or your own Knative app, and are unable to use the "Magic DNS
511+
(xip.io)" or "Real DNS" methods, there is a temporary approach. This is useful
512+
for those who wish to evaluate Knative without altering their DNS configuration,
513+
as per the "Real DNS" method, or cannot use the "Magic DNS" method due to using,
514+
for example, minikube locally or IPv6 clusters.
515+
516+
To access your application using `curl` using this method:
517+
518+
1. After starting your application, get the URL of your application:
519+
520+
```bash
521+
kubectl get ksvc
522+
```
523+
524+
The output should be similar to:
525+
526+
```bash
527+
NAME URL LATESTCREATED LATESTREADY READY REASON
528+
helloworld-go http://helloworld-go.default.example.com helloworld-go-vqjlf helloworld-go-vqjlf True
529+
```
530+
531+
1. Instruct `curl` to connect to the External IP or CNAME defined by the
532+
networking layer in section 3 above, and use the `-H "Host:"` command-line
533+
option to specify the Knative application's host name. For example, if the
534+
networking layer defines your External IP and port to be
535+
`http://192.168.39.228:32198` and you wish to access the above
536+
`helloworld-go` application, use:
537+
538+
```bash
539+
curl -H "Host: helloworld-go.default.example.com" http://192.168.39.228:32198
540+
```
541+
542+
In the case of the provided `helloworld-go` sample application, using the default
543+
configuration, the output should be:
544+
545+
```
546+
Hello Go Sample v1!
547+
```
548+
549+
Refer to the "Real DNS" method for a permanent solution.
550+
551+
{{< /tab >}}
552+
553+
{{< /tabs >}}
554+
555+
1. Monitor the Knative components until all of the components show a `STATUS` of
556+
`Running` or `Completed`:
557+
558+
```bash
559+
kubectl get pods --namespace knative-serving
560+
```
561+
210562
### Installing the Knative Eventing component
211563
212564
1. Create and apply the Knative Eventing CR:

0 commit comments

Comments
 (0)