Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/dns-dual-protocol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
spec:
containers:
- name: coredns
image: coredns/coredns:1.11.1
image: docker.io/coredns/coredns:1.11.1
args:
- -conf
- /etc/coredns/Corefile
Expand Down
2 changes: 1 addition & 1 deletion examples/external-traffic-policy-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
spec:
containers:
- name: hello
image: nginxdemos/hello:plain-text
image: docker.io/nginxdemos/hello:plain-text
---
apiVersion: v1
kind: Service
Expand Down
132 changes: 132 additions & 0 deletions examples/gateway-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Deploys two docker.io/nginxdemos/hello:plain-text containers ("blue" and "red")
# and creates ClusterIP services named "blue-svc" and "red-svc" for the
# deployments.
# Additionally:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in addition to these references, we might want to add a paragraph about how this can be enabled on the k8test cluster (with the commands mentioned in the PR description, and a hint about how to connect to the control host with a k8test setup: ssh ubuntu@<ip> -i k8test/cluster/ssh).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added the information on how to setup the example with k8test.

Can you elaborate why you think it might be helpful to add information on how to connect to the control host? k8test provides a kubeconfig which can be used for connecting to the cluster and that's all that's needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant mainly to execute the cilium task. I assume you have to run cilium upgrade --set kubeProxyReplacement=true --set gatewayAPI.enabled=true on the control host, no?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@href I guess you could run it on the control host but it's fine to run it on your own host machine, given that you set the KUBECONFIG to the right target.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I do not have cilium installed locally, but the description you added works well enough, thanks.

# - a Gateway resource named "my-gateway" using Cilium Gateway-API is set up
# - a HTTPRoute named "simple" using "my-gateway" is used to route requests for "/red" to "red-svc" service and
# requests for "/blue" to the "blue-svc" service.
#
# This examples needs cilium with Gateway-API support to be installed, see:
# https://docs.cilium.io/en/stable/network/servicemesh/gateway-api/gateway-api/#gs-gateway-api
# https://gateway-api.sigs.k8s.io/guides/
#
# Setup using k8test (https://github.com/cloudscale-ch/k8test):
# $ export KUBECONFIG=k8test/cluster/admin.conf
# $ kubectl apply --server-side -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.4.1/experimental-install.yaml
# $ cilium upgrade --set kubeProxyReplacement=true --set gatewayAPI.enabled=true
# $ kubectl apply -f examples/gateway-api.yaml
#
# Wait for `kubectl get gateway my-gateway` to
# show "PROGRAMMED: True", then use the IP address found under "ADDRESS" to connect to the service.
#
# You can also use the following shortcut:
#
# curl http://$(kubectl get gateway my-gateway -o jsonpath='{.status.addresses[0].value}')/blue
# curl http://$(kubectl get gateway my-gateway -o jsonpath='{.status.addresses[0].value}')/red
#
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: blue
name: blue
spec:
replicas: 1
selector:
matchLabels:
app: blue
template:
metadata:
labels:
app: blue
spec:
containers:
- image: docker.io/nginxdemos/hello:plain-text
name: hello
---
apiVersion: v1
kind: Service
metadata:
labels:
app: blue
name: blue-svc
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: blue
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: red
name: red
spec:
replicas: 1
selector:
matchLabels:
app: red
template:
metadata:
labels:
app: red
spec:
containers:
- image: docker.io/nginxdemos/hello:plain-text
name: hello
resources: { }
---
apiVersion: v1
kind: Service
metadata:
labels:
app: red
name: red-svc
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: red
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: my-gateway
spec:
gatewayClassName: cilium
listeners:
- protocol: HTTP
port: 80
name: web-gw
allowedRoutes:
namespaces:
from: Same
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: simple
spec:
parentRefs:
- name: my-gateway
rules:
- matches:
- path:
type: Exact
value: /red
backendRefs:
- name: red-svc
port: 80
- matches:
- path:
type: Exact
value: /blue
backendRefs:
- name: blue-svc
port: 80
6 changes: 3 additions & 3 deletions examples/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Deploys two nginxdemos/hello:plain-text containers ("blue" and "red")
# Deploys two docker.io/nginxdemos/hello:plain-text containers ("blue" and "red")
# and creates ClusterIP services named "blue-svc" and "red-svc" for the
# deployments. Additionally, an Ingress resource named "simple" is set
# up to route requests for "/red" to "red-svc" service and
Expand Down Expand Up @@ -37,7 +37,7 @@ spec:
app: blue
spec:
containers:
- image: nginxdemos/hello:plain-text
- image: docker.io/nginxdemos/hello:plain-text
name: hello
---
apiVersion: v1
Expand Down Expand Up @@ -71,7 +71,7 @@ spec:
app: red
spec:
containers:
- image: nginxdemos/hello:plain-text
- image: docker.io/nginxdemos/hello:plain-text
name: hello
resources: { }
---
Expand Down
4 changes: 2 additions & 2 deletions examples/nginx-hello.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Deploys the nginxdemos/hello:plain-text container and creates a
# Deploys the docker.io/nginxdemos/hello:plain-text container and creates a
# loadbalancer service for it:
#
# export KUBECONFIG=path/to/kubeconfig
Expand Down Expand Up @@ -34,7 +34,7 @@ spec:
spec:
containers:
- name: hello
image: nginxdemos/hello:plain-text
image: docker.io/nginxdemos/hello:plain-text
---
apiVersion: v1
kind: Service
Expand Down
2 changes: 1 addition & 1 deletion examples/proxy-v2-protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
spec:
containers:
- name: proxy-hello
image: nginxdemos/hello:plain-text
image: docker.io/nginxdemos/hello:plain-text
volumeMounts:
- name: nginx-config-volume
mountPath: /etc/nginx/nginx.conf
Expand Down
Loading