-
Notifications
You must be signed in to change notification settings - Fork 1
adds gateway-api example #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | ||
| # - 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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).There was a problem hiding this comment.
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?
k8testprovides a kubeconfig which can be used for connecting to the cluster and that's all that's needed.There was a problem hiding this comment.
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
ciliumtask. I assume you have to runcilium upgrade --set kubeProxyReplacement=true --set gatewayAPI.enabled=trueon the control host, no?There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.