Skip to content

Instantly share code, notes, and snippets.

@smothiki
Last active March 22, 2016 20:25
Show Gist options
  • Save smothiki/ecc330455b3511af9343 to your computer and use it in GitHub Desktop.
Save smothiki/ecc330455b3511af9343 to your computer and use it in GitHub Desktop.
service endpoints api
smothiki$ kubectl get endpoints --all-namespaces -w
NAMESPACE         NAME                    ENDPOINTS
absurd-lakeside   absurd-lakeside         <none>
default           kubernetes              10.0.0.50:443
deis              deis-builder            10.2.44.2:2223
deis              deis-controller         10.2.94.2:8000
deis              deis-database           10.2.44.3:5432
deis              deis-minio              10.2.94.5:9000
deis              deis-registry           10.2.94.3:5000
deis              deis-router             10.2.44.4:8080,10.2.44.4:6443,10.2.44.4:2222 + 1 more...
deis              deis-workflow-manager   10.2.94.4:8080
# scaled italic-teamwork app to 3

italic-teamwork   italic-teamwork         10.2.44.5:5000,10.2.66.3:5000,10.2.66.7:5000
kube-system       kube-dns                10.2.66.2:53,10.2.66.2:53
rubber-vagabond   rubber-vagabond         <none>
NAMESPACE         NAME              ENDPOINTS
italic-teamwork   italic-teamwork   10.2.44.5:5000,10.2.66.7:5000
# scaled italic-teamwork app to 0
italic-teamwork   italic-teamwork   <none>
# destroyed italic-teamwork 
italic-teamwork   italic-teamwork   <none>
# created iciest-gadabout
iciest-gadabout   iciest-gadabout   <none>
iciest-gadabout   iciest-gadabout   <none>
# 1st git push iciest-gadabout
iciest-gadabout   iciest-gadabout   
iciest-gadabout   iciest-gadabout   10.2.44.5:5000
# scaled iciest-gadabout to 3
iciest-gadabout   iciest-gadabout   10.2.44.5:5000
iciest-gadabout   iciest-gadabout   10.2.44.5:5000,10.2.66.3:5000
iciest-gadabout   iciest-gadabout   10.2.44.5:5000,10.2.66.3:5000
iciest-gadabout   iciest-gadabout   10.2.44.5:5000,10.2.66.3:5000,10.2.94.6:5000
@smothiki
Copy link
Author

Three cases

  1. service created and no pods running
  2. service created and scaled to zero
  3. services created and some pods running.

for all these cases simple solution will be dont create and upstream nginx conf if endpoints is nil or remove upstream nginx conf if endpoints changed to nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment