Last active
March 1, 2021 09:58
-
-
Save kevinswiber/e6a8245930676c3da3448b2bb79f23fd to your computer and use it in GitHub Desktop.
Kubernetes resources for standing up Express Gateway
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
#!/bin/bash | |
kubectl create -f https://gist.githubusercontent.com/kevinswiber/e6a8245930676c3da3448b2bb79f23fd/raw/0869b72410851e2ab02d0c1c30443f4083345066/configmap.yaml | |
kubectl create -f https://gist.githubusercontent.com/kevinswiber/e6a8245930676c3da3448b2bb79f23fd/raw/0869b72410851e2ab02d0c1c30443f4083345066/deployment.yaml | |
kubectl create -f https://gist.githubusercontent.com/kevinswiber/e6a8245930676c3da3448b2bb79f23fd/raw/0869b72410851e2ab02d0c1c30443f4083345066/service.yaml |
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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: 'express-gateway-config' | |
data: | |
gateway.config.yml: | | |
http: | |
host: '*' | |
port: 8080 | |
admin: | |
host: '0.0.0.0' | |
port: 9876 | |
apiEndpoints: | |
api: | |
host: '*' | |
paths: '/ip' | |
serviceEndpoints: | |
httpbin: | |
url: 'https://httpbin.org' | |
policies: | |
- jwt | |
- oauth2 | |
- proxy | |
pipelines: | |
- name: default | |
apiEndpoints: | |
- api | |
policies: | |
# - jwt: | |
# - action: | |
# checkCredentialExistence: false | |
# secretOrPublicKeyFile: '/app/key.pem' | |
- proxy: | |
- action: | |
serviceEndpoint: httpbin | |
changeOrigin: true | |
system.config.yml: | | |
db: | |
redis: | |
emulate: true | |
namespace: EG- | |
crypto: | |
cipherKey: sensitiveKey | |
algorithm: aes256 | |
saltRounds: 10 | |
session: | |
secret: keyboard cat | |
resave: false | |
saveUninitialized: false | |
accessTokens: | |
timeToExpiry: 7200000 | |
refreshTokens: | |
timeToExpiry: 7200000 | |
authorizationCodes: | |
timeToExpiry: 7200000 |
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
apiVersion: apps/v1beta2 # for Kubernetes v1.9.x, use apps/v1 | |
kind: Deployment | |
metadata: | |
name: express-gateway | |
labels: | |
app: express-gateway | |
spec: | |
selector: | |
matchLabels: | |
app: express-gateway | |
template: | |
metadata: | |
labels: | |
app: express-gateway | |
spec: | |
volumes: | |
- name: config | |
configMap: | |
name: express-gateway-config | |
containers: | |
- name: express-gateway | |
image: expressgateway/express-gateway:latest | |
imagePullPolicy: Always | |
env: | |
- name: EG_CONFIG_DIR | |
value: '/usr/src/app/config' | |
- name: LOG_LEVEL | |
value: debug | |
ports: | |
- name: gateway | |
containerPort: 8080 | |
- name: admin | |
containerPort: 9876 | |
volumeMounts: | |
- name: config | |
mountPath: '/usr/src/app/config/system.config.yml' | |
subPath: 'system.config.yml' | |
- name: config | |
mountPath: '/usr/src/app/config/gateway.config.yml' | |
subPath: 'gateway.config.yml' |
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
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: express-gateway-service | |
spec: | |
selector: | |
app: express-gateway | |
type: NodePort | |
ports: | |
- name: 'gateway' | |
port: 80 | |
targetPort: 'gateway' | |
nodePort: 31313 | |
protocol: TCP | |
- name: 'admin' | |
port: 9876 | |
targetPort: 'admin' | |
nodePort: 31314 | |
protocol: TCP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment