Side Car Injection
- Inject the sidecar into the application pods
kubectl get deployment arcadia-frontend -oyaml | ./files/binaries/nginx-meshctl inject | kubectl apply -f -
kubectl get deployment arcadia-login -oyaml | ./files/binaries/nginx-meshctl inject | kubectl apply -f -
kubectl get deployment arcadia-stock-transaction -oyaml | ./files/binaries/nginx-meshctl inject | kubectl apply -f -
kubectl get deployment arcadia-stocks -oyaml | ./files/binaries/nginx-meshctl inject | kubectl apply -f -
kubectl get deployment arcadia-users -oyaml | ./files/binaries/nginx-meshctl inject | kubectl apply -f -
- Wait for the sidecar to be injected in all pods and verify that the pods have 2 containers
kubectl get pods
Output
- Propagate the opentracing headers so we can get full visibility within the mesh
cat << EOF | kubectl apply -f -
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: arcadia
spec:
host: $nginx_ingress
tls:
secret: arcadia-wildcard # Represents the server certificate
redirect:
enable: true # Always redirect to https if incoming request is http
upstreams:
- name: arcadia-users
service: arcadia-users
port: 80
healthCheck: # This is the most basic healthcheck config for more info follow this link https://docs.nginx.com/nginx-ingress-controller/configuration/virtualserver-and-virtualserverroute-resources/#upstream-healthcheck
enable: true
path: /healthz
- name: arcadia-login
service: arcadia-login
port: 80
healthCheck:
enable: true
path: /healthz
- name: arcadia-stocks
service: arcadia-stocks
port: 80
healthCheck:
enable: true
path: /healthz
- name: arcadia-stock-transaction
service: arcadia-stock-transaction
port: 80
healthCheck:
enable: true
path: /healthz
- name: arcadia-frontend
service: arcadia-frontend
port: 80
healthCheck:
enable: true
path: /healthz
routes:
- path: /v1/user
location-snippets: |
opentracing_propagate_context;
opentracing_operation_name "nginx-ingress";
policies:
- name: jwt-policy
action:
proxy:
upstream: arcadia-users
requestHeaders:
set:
- name: okta-user
value: \${jwt_claim_email}
- path: /v1/login
location-snippets: |
opentracing_propagate_context;
opentracing_operation_name "nginx-ingress";
action:
pass: arcadia-login
- path: /v1/stock
location-snippets: |
opentracing_propagate_context;
opentracing_operation_name "nginx-ingress";
action:
pass: arcadia-stocks
- path: /v1/stockt
location-snippets: |
opentracing_propagate_context;
opentracing_operation_name "nginx-ingress";
policies:
- name: jwt-policy
action:
proxy:
upstream: arcadia-stock-transaction
requestHeaders:
set:
- name: okta-user
value: \${jwt_claim_email}
- path: /
location-snippets: |
opentracing_propagate_context;
opentracing_operation_name "nginx-ingress";
action:
pass: arcadia-frontend
EOF