<p>I'm upgrading my elasticsearch on kubernetes cluster from 5.6.10 to elasticsearch 6.1.4. However, I can't even get es 6.1.4 to launch. </p>

<p>I keep getting the error <code>unknown setting [xpack.license.self_generated.type]</code>. </p>

<p><a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.x/license-settings.html" rel="nofollow noreferrer">Per the docs</a>, I tried setting the value to basic, <code>xpack.license.self_generated.type=basic</code> and I've also omitted the value all together.</p>

<p>I've seen a few others run into this error but none of their fixes have worked for me.</p>

<p>Help is much appreciated!</p>

<p>My stateful set yaml</p>

<pre><code>apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: elastic-data
  labels:
    app: elastic-data
    area: devs
    role: nosql
    version: "6.1.4"
    environment: elastic
spec:
  serviceName: elastic-data
  replicas: 1
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: elastic-data
        area: devs
        role: nosql
        version: "6.1.4"
        environment: elastic
      annotations:
        pod.beta.kubernetes.io/init-containers: '[
          {
          "name": "sysctl",
            "image": "busybox",
            "imagePullPolicy": "IfNotPresent",
            "command": ["sysctl", "-w", "vm.max_map_count=262144"],
            "securityContext": {
              "privileged": true
            }
          }
        ]'
    spec:
      terminationGracePeriodSeconds: 10
      securityContext:
        runAsUser: 1000
        fsGroup: 1000
      containers:
      - name: elastic-data
        image: docker.elastic.co/elasticsearch/elasticsearch:6.1.4
        resources:
          requests:
            memory: "512Mi"
          limits:
            memory: "1024Mi"
        env:
        - name: ES_JAVA_OPTS
          value: -Xms512m -Xmx512m
        command: ["/bin/bash", "-c", "~/bin/elasticsearch-plugin remove x-pack; elasticsearch"]
        args:
        - -Ecluster.name=elastic-devs
        - -Enode.name=${HOSTNAME}
        - -Ediscovery.zen.ping.unicast.hosts=elastic-master.default.svc.cluster.local
        - -Enode.master=false
        - -Enode.data=true
        - -Enode.ingest=false
        - -Enetwork.host=0.0.0.0
        - -Expack.license.self_generated.type=basic    
        ports:
        - containerPort: 9300
          name: transport
        - containerPort: 9200
          name: http
        volumeMounts:
        - name: data-volume
          mountPath: /usr/share/elasticsearch/data
        readinessProbe:
          tcpSocket:
            port: 9300
          initialDelaySeconds: 30
          periodSeconds: 30
          timeoutSeconds: 3
        livenessProbe:
          tcpSocket:
            port: 9300
          initialDelaySeconds: 30
          periodSeconds: 30
          timeoutSeconds: 3
  volumeClaimTemplates:
  - metadata:
      name: data-volume
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 2Gi
</code></pre>

Mike
<p>As they are trying to communicate, you forgot to remove the configuration property from <code>config/elasticsearch.yml</code>. So, the full revised <code>command:</code> would be</p>

<pre><code>~/bin/elasticsearch-plugin remove x-pack
sed -i.bak -e /xpack.license.self_generated.type/d config/elasticsearch.yml
elasticsearch
</code></pre>

<p>Don't get me wrong, it's <strong>very silly</strong> of them to bomb over a config property for something that doesn't exist, but that's apparently the way it is.</p>

<hr>

<p>p.s. you may be happier with the <code>--purge</code> option, since when I tried that command locally <code>elasticsearch-plugin</code> cheerfully advised:</p>

<blockquote>
  <p>-> preserving plugin config files [/usr/share/elasticsearch/config/x-pack] in case of upgrade; use --purge if not needed</p>
</blockquote>

<p>thus: <code>./bin/elasticsearch-plugin remove x-pack --purge</code></p>
