User Tools

Site Tools


wikiv3:kubernetes_dokuwiki

Dokuwiki

$ kubectl create namespace dokuwiki-system
namespace/dokuwiki-system created
claim-dokuwiki-nfs.yaml
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: nfs-claim-dokuwiki
  namespace: dokuwiki-system
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: nfs-client
  resources:
    requests:
      storage: 4Gi
$ kubectl apply -f claim-dokuwiki-nfs.yaml
persistentvolumeclaim/nfs-claim-dokuwiki created
$ kubectl get pv,pvc -n dokuwiki-system
NAME                                                        CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                STORAGECLASS   REASON   AGE
persistentvolume/pvc-a6b52e3c-bec6-4b20-9c07-3d4afe262807   4Gi        RWO            Delete           Bound    dokuwiki-system/nfs-claim-dokuwiki   nfs-client              34s
 
NAME                                       STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
persistentvolumeclaim/nfs-claim-dokuwiki   Bound    pvc-a6b52e3c-bec6-4b20-9c07-3d4afe262807   4Gi        RWO            nfs-client     34s
$ kubectl describe pv pvc-a6b52e3c-bec6-4b20-9c07-3d4afe262807 -n dokuwiki-system
Name:            pvc-a6b52e3c-bec6-4b20-9c07-3d4afe262807
Labels:          <none>
Annotations:     pv.kubernetes.io/provisioned-by: k8s-sigs.io/nfs-subdir-external-provisioner
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    nfs-client
Status:          Bound
Claim:           dokuwiki-system/nfs-claim-dokuwiki
Reclaim Policy:  Delete
Access Modes:    RWO
VolumeMode:      Filesystem
Capacity:        4Gi
Node Affinity:   <none>
Message:
Source:
    Type:      NFS (an NFS mount that lasts the lifetime of a pod)
    Server:    177.75.176.43
    Path:      /nfs/kubedata/dokuwiki-system-nfs-claim-dokuwiki-pvc-a6b52e3c-bec6-4b20-9c07-3d4afe262807
    ReadOnly:  false
Events:        <none>
$ kubectl describe pvc nfs-claim-dokuwiki -n dokuwiki-system
Name:          nfs-claim-dokuwiki
Namespace:     dokuwiki-system
StorageClass:  nfs-client
Status:        Bound
Volume:        pvc-a6b52e3c-bec6-4b20-9c07-3d4afe262807
Labels:        <none>
Annotations:   pv.kubernetes.io/bind-completed: yes
               pv.kubernetes.io/bound-by-controller: yes
               volume.beta.kubernetes.io/storage-provisioner: k8s-sigs.io/nfs-subdir-external-provisioner
               volume.kubernetes.io/storage-provisioner: k8s-sigs.io/nfs-subdir-external-provisioner
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      4Gi
Access Modes:  RWO
VolumeMode:    Filesystem
Used By:       <none>
Events:
  Type    Reason                 Age    From                                                                                                                      Message
  ----    ------                 ----   ----                                                                                                                      -------
  Normal  ExternalProvisioning   2m41s  persistentvolume-controller                                                                                               waiting for a volume to be created, either by external provisioner "k8s-sigs.io/nfs-subdir-external-provisioner" or manually created by system administrator
  Normal  Provisioning           2m41s  k8s-sigs.io/nfs-subdir-external-provisioner_nfs-client-provisioner-8686cbd686-dbrgn_d5efe716-aabd-4493-bcb1-225f0584fee0  External provisioner is provisioning volume for claim "dokuwiki-system/nfs-claim-dokuwiki"
  Normal  ProvisioningSucceeded  2m41s  k8s-sigs.io/nfs-subdir-external-provisioner_nfs-client-provisioner-8686cbd686-dbrgn_d5efe716-aabd-4493-bcb1-225f0584fee0  Successfully provisioned volume pvc-a6b52e3c-bec6-4b20-9c07-3d4afe262807
dokuwiki-deployment.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: dokuwiki
  name: dokuwiki
  namespace: dokuwiki-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: dokuwiki
  strategy: {}
  template:
    metadata:
      labels:
        app: dokuwiki
    spec:
      containers:
        - image: docker.io/bitnami/dokuwiki:latest
          name: dokuwiki
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8080
            - containerPort: 8443
          volumeMounts:
            - mountPath: /bitnami/dokuwiki
              name: dokuwiki-data
      volumes:
        - name: dokuwiki-data
          persistentVolumeClaim:
            claimName: nfs-claim-dokuwiki
$ kubectl apply -f dokuwiki-deployment.yaml
deployment.apps/dokuwiki created
$ kubectl get all -n dokuwiki-system -o wide
NAME                            READY   STATUS    RESTARTS   AGE   IP               NODE                                 NOMINATED NODE   READINESS GATES
pod/dokuwiki-65cdd686fb-qfmhb   1/1     Running   0          33s   10.244.213.135   kube-worker-02.juntotelecom.com.br   <none>           <none>
 
NAME                       READY   UP-TO-DATE   AVAILABLE   AGE   CONTAINERS   IMAGES                              SELECTOR
deployment.apps/dokuwiki   1/1     1            1           33s   dokuwiki     docker.io/bitnami/dokuwiki:latest   app=dokuwiki
 
NAME                                  DESIRED   CURRENT   READY   AGE   CONTAINERS   IMAGES                              SELECTOR
replicaset.apps/dokuwiki-65cdd686fb   1         1         1       33s   dokuwiki     docker.io/bitnami/dokuwiki:latest   app=dokuwiki,pod-template-hash=65cdd686fb
dokuwiki-service.yaml
---
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    app: dokuwiki
  name: dokuwiki
  namespace: dokuwiki-system
spec:
  ipFamilyPolicy: PreferDualStack
  ipFamilies:
    - IPv4
    - IPv6
  ports:
    - name: "80"
      port: 80
      targetPort: 8080
    - name: "443"
      port: 443
      targetPort: 8443
  selector:
    app: dokuwiki
  type: NodePort
status:
  loadBalancer: {}
$ kubectl apply -f dokuwiki-service.yaml
service/dokuwiki created
$ kubectl get service -n dokuwiki-system
NAME       TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
dokuwiki   NodePort   10.96.241.140   <none>        80:31246/TCP,443:31532/TCP   35s
$ kubectl describe service dokuwiki -n dokuwiki-system
Name:                     dokuwiki
Namespace:                dokuwiki-system
Labels:                   app=dokuwiki
Annotations:              <none>
Selector:                 app=dokuwiki
Type:                     NodePort
IP Family Policy:         PreferDualStack
IP Families:              IPv4,IPv6
IP:                       10.96.241.140
IPs:                      10.96.241.140,fd00:0:0:100::b29d
Port:                     80  80/TCP
TargetPort:               8080/TCP
NodePort:                 80  31246/TCP
Endpoints:                10.244.213.135:8080
Port:                     443  443/TCP
TargetPort:               8443/TCP
NodePort:                 443  31532/TCP
Endpoints:                10.244.213.135:8443
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
$ curl http://127.0.0.1:31246
<!DOCTYPE html>
<html lang="en" dir="ltr" class="no-js">
<head>
[...]
dokuwiki-ingress.yaml
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  creationTimestamp: null
  name: dokuwiki
  namespace: dokuwiki-system
spec:
  ingressClassName: nginx
  rules:
  - host: dokuwiki.juntotelecom.com.br
    http:
      paths:
      - backend:
          service:
            name: dokuwiki
            port:
              number: 8080
        path: /
        pathType: Prefix
status:
  loadBalancer: {}
$ kubectl apply -f dokuwiki-ingress.yaml
ingress.networking.k8s.io/dokuwiki created
$ kubectl get ingress -n dokuwiki-system
NAME       CLASS   HOSTS                          ADDRESS         PORTS   AGE
dokuwiki   nginx   dokuwiki.juntotelecom.com.br   177.75.176.41   80      88s
$ kubectl describe ingress dokuwiki -n dokuwiki-system
Name:             dokuwiki
Labels:           <none>
Namespace:        dokuwiki-system
Address:          177.75.176.41
Ingress Class:    nginx
Default backend:  <default>
Rules:
  Host                          Path  Backends
  ----                          ----  --------
  dokuwiki.juntotelecom.com.br
                                /   dokuwiki:8080 ()
Annotations:                    <none>
Events:
  Type    Reason  Age                 From                      Message
  ----    ------  ----                ----                      -------
  Normal  Sync    63s (x2 over 106s)  nginx-ingress-controller  Scheduled for sync
wikiv3/kubernetes_dokuwiki.txt · Last modified: by 127.0.0.1