Comments (8)
From @bacongobbler on March 6, 2017 15:27
It is not possible to reference the downward API today with pods. However, you can infer the pod namespace by the application name, which is available in the environment. The pod IP and others are currently unavailable, however we've generally pushed back on that due to concerns of exposing the cluster to the application developer (most multi-tenant systems like Heroku do not give you host information, for example).
If you'd like to take a tackle at this, you probably will want to make a proposal or write documentation that comes up with a couple use cases for this as well as how it'd look in the CLI, then write a PR against that doc.
Hope this helps!
from workflow.
From @gottfrois on March 6, 2017 15:45
thanks @bacongobbler for the quick answer. Being able to know POD IP as well as the host the POD is running on might be valuable information in order to force services communication to go through a service mesh running as a DaemonSet on the same host the POD is running.
I'm using linkerd to abstract services communication and the way it is setup is by having all http requests proxy through the linkerd instance running on the same host as the POD.
Here is the k8s POD configuration:
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: http_proxy
value: $(NODE_NAME):4140
The POD_IP
is really just to ensure load balancing is working while testing my setup but the NODE_NAME
is used to make sure we proxy http requests through the local instance of linkerd.
Hope it helps to understand the usecase better.
Do you see any workaround for the moment?
from workflow.
From @gottfrois on March 6, 2017 16:2
The workaround I see is to manually query the k8s api within the POD using the following command:
$ KUBE_TOKEN=$(< /var/run/secrets/kubernetes.io/serviceaccount/token)
$ curl -sk -H "Authorization: Bearer $KUBE_TOKEN" https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT/api/v1/namespaces/default/pods/$HOSTNAME | jq '.status.hostIP' | sed 's/"//g'
10.240.0.5
from workflow.
From @gottfrois on March 6, 2017 16:13
It would then be possible to execute a bash script to populate the HTTP_PROXY
env variable:
command:
- "/bin/bash"
- "-c"
- "HTTP_PROXY=`./hostIP.sh`:4140 ..."
but is there a way to execute arbitraty commands on deis? Maybe in the Procfile directly!?
web: HTTP_PROXY=`./hostIP.sh`:4140 bundle exec puma -C config/puma.rb
from workflow.
From @robholland on March 29, 2017 8:51
@gottfrois Could you not have your config/puma.rb
set the variable?
from workflow.
From @gottfrois on March 29, 2017 10:4
using a shell script called from the procfile worked, i guess it could be done in puma config as well yes
from workflow.
I'm guessing this could also be accomplished using a webhook and a MutatingWebhookConfiguration. I'm currently experimenting with that approach.
from workflow.
Let us know if you figure out a more elegant way @lshemesh ! 👍 There is also the lifecyclehooks as we talked about which are there but not really documented anywhere yet.
from workflow.
Related Issues (20)
- AWS ALB/NLB support?
- Docs: broken link(s) to Deis blog HOT 7
- ssh_exchange_identification: read: Connection reset by peer HOT 7
- There is an incredibly amount of verbose output when a buildpack is not matched HOT 5
- Helm install fails HOT 2
- Simple installation of Hephy wouldn't work. Client on Mac OS X and Cluster on AWS HOT 13
- Unable to install hephy workflow HOT 18
- How to manage application databases with workflow? HOT 6
- `deis certs` doesn't show certs added by another (admin) user HOT 2
- Unable to install onto Kubernetes 1.18.3 HOT 2
- ps:restart should rolling restart the pods HOT 2
- deis logs is not returning pod logs HOT 7
- Guide for Rancher HOT 6
- error upgrading from very old install, hephy/postgres:v2.7.3 boots but hephy/postgres:v2.7.6 does not. HOT 5
- Chart is broken. HOT 1
- [feature request] Enable to drop monitor HOT 1
- [feature support] Enable to add affinities. HOT 6
- Is this still actively maintained? HOT 2
- Automated release of workflow/docs HOT 2
- Add x-forwarded-host to the nginx config in the deis-router for ruby apps issue HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from workflow.