Encrypt and authorize traffic between services.
- unencrypted traffic on loopback interface only
cat <<EOF > '/etc/consul.d/python-webapp.json'
{
"service": {
"name": "python-webapp",
"port": 3000,
"connect": { "sidecar_service": {} }
}
}
EOF
systemctl reload consul
consul connect proxy -sidecar-for python-webapp
This looks for a consul-connect capable endpoint for this service.
consul connect proxy -service web -upstream python-webapp:3000
Create a 'web' service with a sidecar registration that configures python-web as an upstream dependency
cat <<EOF > '/etc/consul.d/web.json'
{
"service": {
"name": "web",
"port": 8080,
"connect": {
"sidecar_service": {
"proxy": {
"upstreams": [{
"destination_name": "python-web",
"local_bind_port": 3000
}]
}
}
}
}
}
EOF
Make sure consul sees the new config:
consul reload
consul connect proxy -sidecar-for web