3.0 KiB
Discovery
DNS
kube-dns
kube-dns is a Kubernetes add-on that works out of the box with Kubernetes-Mesos.
For details on usage see the implementation in the cluster/mesos/docker
source tree.
kube-dns provides records both for services and pods.
mesos-dns
NOTE: There is still no support for publishing Kubernetes services in mesos-dns.
mesos-dns communicates with the leading Mesos master to build a DNS record set that reflects the tasks running in a Mesos cluster as documented here: http://mesosphere.github.io/mesos-dns/docs/naming.html. As of Kubernetes-Mesos release v0.7.2 there is experimental support in the scheduler to populate a task's discovery-info field in order to generate alternative/more friendly record names in mesos-dns, for pods only.
To enable this feature, set --mesos-generate-task-discovery=true
when launching the scheduler.
The following discovery-info fields may be set using labels (without a namespace prefix) or else k8s.mesosphere.io/discovery-XXX
annotations:
visibility
: may beframework
,external
, orcluster
(defaults tocluster
)environment
location
name
(this alters record set generation in mesos-dns)version
In the case where both a label as well as an annotation are supplied the value of the annotation is observed.
The interpretation of value of the name
label (and discovery-name
annotation) is a special case: the generated Mesos discovery-info.name
value will be ${name}.${pod-namespace}.pod
; all other discovery-info values are passed through without modification.
Example 1: Use a name
label on a pod template
apiVersion: v1
kind: ReplicationController
metadata:
name: frontend
spec:
replicas: 3
template:
metadata:
labels:
app: guestbook
tier: frontend
name: custom-name
spec:
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: GET_HOSTS_FROM
value: dns
ports:
- containerPort: 80
Example 2: Use a discovery-name
annotation on a pod template
apiVersion: v1
kind: ReplicationController
metadata:
name: frontend
spec:
replicas: 3
template:
metadata:
labels:
app: guestbook
tier: frontend
annotations:
k8s.mesosphere.io/discovery-name: custom-name
spec:
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: GET_HOSTS_FROM
value: dns
ports:
- containerPort: 80