I want to get my Elixir app to run with libcluster on Google Kubernetes Engine.
I found a similar article that’s somewhat related. This article talks about how to create a “headless service” that returns all the pod IPs, which he then passes into Peerage. You can search for myapp-service-headless to find his Kubernetes YAML file.
It looks like Peerage provides the same functionality
Unfortunately I don’t really understand the exact configuration with GKE + Libcluster.
I want to use the DNS A record method they mention in this doc (for some reason this doesnt match up with the docs with the same module name… maybe its out of date?). So far I DID get POD_IP and NAMESPACE properly passed into the docker container. So that step is good.
Here are my questions:
I need a headless service right? It seems like the “DNS” method is preferable (the 2nd link). I tried making a headless service which matches that config in the article above, but it just says 0 pods and looks like it’s not working
It says I should be able to run kubectl get endpoints -l app=myapp. I assume this is referring to the headless endpoint? Is that needed for both strategies?
Here is my headless service YAML (thats not working):
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2018-12-24T06:22:20Z
labels:
app: xyz-headless
name: xyz-headless
namespace: default
resourceVersion: "251868"
selfLink: /api/v1/namespaces/default/services/xyz-headless
uid: 12345
spec:
clusterIP: None
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: xyz-web ### this is actually my "deployment"... awsnt sure what to put here
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
Hi all, this post was incredibly helpful for me (THANK YOU!) and I wanted to share our final configuration, in case it helps anyone else. We’re using Google Kubernetes with libcluster. The Elixir apps are accessible by the web via a load balancer that use a google managed SSL certificate. They can access each other via that headless service.
you’ve got a static external IP address (staging-managed-ip in this example),
and you’ve got an SSL certficiate set up on Google Cloud Platform (staging in this example).
If that’s the case, you should be able to set up a cluster with some node pools and run kubectl apply -f ./kubernetes/all-together-now.yaml. It will create a deployment, a service, an ingress, and a headless-service (which is the key bit to getting #libcluster 's Kubernetes.DNS strategy to work. Hope this helps.