cat << EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: microgateway
spec:
replicas: 1
selector:
matchLabels:
app: microgateway
template:
metadata:
labels:
app: microgateway
spec:
containers:
- name: microgateway1
image: sorinboia/ngtest:3.4
imagePullPolicy: Always
env:
- name: API_KEY
value: $controller_apikey
- name: CTRL_HOST
value: $controller_ip
- name: HOSTNAME
value: microgateway1
ports:
- containerPort: 80
readinessProbe:
exec:
command:
- curl
- 127.0.0.1:49151/api
initialDelaySeconds: 5
periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
name: microgateway
spec:
selector:
app: microgateway
ports:
- port: 80
targetPort: 80
name: http
- port: 443
targetPort: 443
name: https
externalTrafficPolicy: Local
type: LoadBalancer
EOF
From now on we will only use the Controller GUI do to all of our configuration.
The end goal will be to expose and protect our APIs both internally within the cluster and externally to other programmers.
You will see the microgateway we just deployed listed. If it is not there wait for about 2 minutes, it might take a little bit of time for the instance to register.
export microhost=$(kubectl get svc microgateway | tr -s " " | cut -d' ' -f4 | grep -v "EXTERNAL-IP") && echo $microhost
Output