kube-wordpress-ssl-yaml

See full article.

Key Points:

  • We changed the image name to end with https to differentiate it from the HTTP version
  • change <your name> to your name
  • change <your domain name> to your DNS name
  • We exposed port 443
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: wordpress-demo
  labels:
    app: wordpress-demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wordpress-demo
  template:
    metadata:
      labels:
        app: wordpress-demo
    spec:
      containers:
      - image:<your name>/wordpress
        imagePullPolicy: Always
        name: wordpress-demo
        env:
        - name: WORDPRESS_DB_HOST
          value: mysql-demo:3306
        - name: WORDPRESS_DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: wpdemosecret
              key: password
        - name: WP_SITE_DOMAIN_NAME
          value: <your domain name>
        - name: PERSISTENT_MOUNT_POINT
          value: /var/www/html
        ports:
        - containerPort: 80
          name: http
        - containerPort: 443
          name: https
        volumeMounts:
        - name: wordpress-demo-vol
          mountPath: /var/www/html
      volumes:
      - name: wordpress-demo-vol
        persistentVolumeClaim:
          claimName: wordpress-demo-claim
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: mysql-demo
  labels:
    app: mysql-demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql-demo
  template:
    metadata:
      labels:
        app: mysql-demo
    spec:
      containers:
      - image: mysql:5.6
        name: mysql-demo
        env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: wpdemosecret
              key: password
        ports:
        - containerPort: 3306
          name: mysql-demo
        volumeMounts:
        - name: mysql-demo-vol
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-demo-vol
        persistentVolumeClaim:
          claimName: mysql-demo-claim