auto-injected nginx sidecar proxy for ucp-swarm-manager, configured to change 500 on /containers/create to 404
- edit
.env
, settingREFERENCE_PREFIX
todtr_hostname/org_or_user/
. - source UCP client bundle
build, push and deploy service:
./deploy.sh buildpush
docker service rm swarm-manager-sidecar-agent
deployment script:
- defines nginx sidecar swarm config
- deploys sidecar agent service
sidecar agent service:
- spec:
- mode global, constrained to managers
- nginx sidecar config
- bind mounts /var/run/docker.sock
- deploy nginx sidecar container with
--network container:ucp-swarm-manager
docker cp
nginx config from swarm config into sidecar, and triggers nginx reload- watche docker container events and redeploys sidecar container when ucp-swarm-manager is started with a different container id
- intercept sigterm and stop sidecar
sidecar:
- spec:
- shares network with ucp-swarm-manager
- cap-add NET_ADMIN
- mounts ucp-node-certs volume
- configures iptables to intercept ingress tcp to 2376, redirects to nginx
- nginx ssl proxy_pass:
- verify client certs
- support upgrade to tcp
- change 500 on /containers/create to 404
- intercept SIGTERM and deconfigures iptables before exit
Lightly. With UCP 2.2.11. Still some rough edges, particularly around use of conntrack to flush at sidecar start time. Would consider this a proof-of-concept at the moment.