<p>I am trying to create a stateful set with definition below but I get this error:</p>

<pre><code>error: unable to recognize "wordpress-database.yaml": no matches for kind "StatefulSet" in version "apps/v1beta2"
</code></pre>

<p>what's wrong?</p>

<p>The yaml file is (please do not consider the alignment of the rows):</p>

<pre><code>apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
name: wordpress-database
spec:
    selector:
matchLabels:
  app: blog
serviceName: "blog"
replicas: 1
template:
metadata:
  labels:
    app: blog 
spec:
  containers:
  - name: database
    image: mysql:5.7
    ports:
    - containerPort: 3306
    env:
    - name: MYSQL_ROOT_PASSWORD
      value: rootPassword
    - name: MYSQL_DATABASE
      value: database
    - name: MYSQL_USER
      value: user
    - name: MYSQL_PASSWORD
      value: password          
    volumeMounts:
    - name: data
      mountPath: /var/lib/mysql
  - name: blog
    image: wordpress:latest
    ports:
    - containerPort: 80
    env:
    - name: WORDPRESS_DB_HOST
      value: 127.0.0.1:3306
    - name: WORDPRESS_DB_NAME
      value: database
    - name: WORDPRESS_DB_USER
      value: user
    - name: WORDPRESS_DB_PASSWORD
      value: password  
  volumeClaimTemplates:
  - metadata:
  name: data
  spec:
  resources:
    requests:
      storage: 1Gi
</code></pre>

Stefano Maglione
<p>The api version of  <code>StatefulSet</code> shoud be:</p>

<pre><code>apiVersion: apps/v1
</code></pre>

<p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer">From the official documentation </a></p>

<p><br>
Good luck.</p>
