Last active
November 11, 2022 00:21
-
-
Save nginx-gists/00ae3b715c657e5b8891a3837438748a to your computer and use it in GitHub Desktop.
Enabling Multi-Tenancy and Namespace Isolation in Kubernetes with NGINX
This file contains 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
apiVersion: k8s.nginx.org/v1 | |
kind: VirtualServer | |
metadata: | |
name: bookinfo | |
namespace: A | |
spec: | |
host: a.bookinfo.com | |
upstreams: | |
- name: productpageA | |
service: productpageA | |
port: 9080 | |
routes: | |
- path: / | |
action: | |
pass: productpageA |
This file contains 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
apiVersion: k8s.nginx.org/v1 | |
kind: VirtualServer | |
metadata: | |
name: bookinfo | |
namespace: B | |
spec: | |
host: b.bookinfo.com | |
upstreams: | |
- name: productpageB | |
service: productpageB | |
port: 9080 | |
routes: | |
- path: / | |
action: | |
pass: productpageB |
This file contains 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
apiVersion: k8s.nginx.org/v1 | |
kind: Policy | |
metadata: | |
name: okta-oidc-policy | |
spec: | |
oidc: | |
clientID: <client_id> | |
clientSecret: okta-oidc-secret | |
authEndpoint: https://<your_okta_domain>/oauth2/v1/authorize | |
tokenEndpoint: https://<your_okta_domain>/oauth2/v1/token | |
jwksURI: https://<your_okta_domain>/oauth2/v1/keys |
This file contains 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
apiVersion: k8s.nginx.org/v1 | |
kind: VirtualServer | |
metadata: | |
name: bookinfo-vs | |
spec: | |
host: bookinfo.example.com | |
tls: | |
secret: bookinfo-secret | |
upstreams: | |
- name: backend | |
service: productpage | |
port: 9080 | |
routes: | |
- path: / | |
policies: | |
- name: okta-oidc-policy | |
action: | |
pass: backend |
This file contains 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
apiVersion: k8s.nginx.org/v1 | |
kind: VirtualServer | |
metadata: | |
name: example | |
spec: | |
host: bookinfo.example.com | |
routes: | |
- path: /productpage-A | |
route: A/ingress | |
- path: /productpage-B | |
route: B/ingress |
This file contains 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
apiVersion: k8s.nginx.org/v1 | |
kind: VirtualServerRoute | |
metadata: | |
name: ingress | |
namespace: A | |
spec: | |
host: bookinfo.example.com | |
upstreams: | |
- name: productpageA | |
service: productpageA-svc | |
port: 9080 | |
subroutes: | |
- path: /productpage-A | |
action: | |
pass: productpageA |
This file contains 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
apiVersion: k8s.nginx.org/v1 | |
kind: VirtualServerRoute | |
metadata: | |
name: ingress | |
namespace: B | |
spec: | |
host: bookinfo.example.com | |
upstreams: | |
- name: productpageB | |
service: productpageB-svc | |
port: 9080 | |
subroutes: | |
- path: /productpage-B | |
action: | |
pass: productpageB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a discussion of these files, see Enabling Multi-Tenancy and Namespace Isolation in Kubernetes with NGINX