<p>I'm crafting a custom REDIS StatefulSet yaml. So far i've succedded in deploying the application but that is something wrong with the REDIS SLAVE. It cant find the master, and i'm not guessing the reason why the DNS configuration is wrong.</p>
<p>My StatefulSet looks like this:</p>
<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis-server
  namespace: scm
  labels:
    app.k8s/name: redis
    app.k8s/instance: server
spec:
  replicas: 3
  serviceName: redis-server
  
  selector:
    matchLabels:
      app.k8s/name: redis
      app.k8s/instance: server
  
  template:
    metadata:
      labels:
        app.k8s/name: redis
        app.k8s/instance: server
    spec:
      containers:
        - name: redis-server
          image: redis:6.0.9-alpine
          imagePullPolicy: IfNotPresent
          command: [&quot;redis-server&quot;, &quot;/data/conf/redis.conf&quot;]
          ports:
            - name: redis
              containerPort: 6379
</code></pre>
<p>and a headless service that looks like:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: redis-server-headless
  namespace: scm
  labels:
    app.k8s/name: redis
    app.k8s/instance: server
    app.k8s/part-of: gitlab
spec:
  type: ClusterIP
  clusterIP: None
  publishNotReadyAddresses: true
  ports:
    - name: server
      port: 6379
      protocol: TCP
      targetPort: redis
  selector:
    app.k8s/name: redis
    app.k8s/instance: server
</code></pre>
<p>When i do a <code>nslookup redis-server-headless</code> i can find the IP addresses but when i try to <code>ping redis-server-0.redis-server-headless</code> or <code>ping redis-server-0.redis-server</code> i get a bad address error message.</p>
<p>What am i missing?</p>

Bruno Araújo
<p>Your <code>serviceName</code> of of redis statefuleset should be <code>redis-server-headless</code>.</p>
