If you see this page, the nginx web server is successfully installed and -working. Further configuration is required.
- -For online documentation and support please refer to
-nginx.org.
-Commercial support is available at
-nginx.com.
Thank you for using nginx.
- - -``` -Check logs of ingress-nginx-controller POD: -``` -root@k3s-master:~# kubectl get pods --all-namespaces |grep ingress-nginx -[...] -ingress-nginx ingress-nginx-controller-d88d95c-khbv4 1/1 Running 0 4m36s -[...] -``` -``` -root@k3s-master:~# kubectl logs ingress-nginx-controller-d88d95c-khbv4 -f -n ingress-nginx -[...] -[10.62.94.1] [23/Aug/2020:16:38:33 +0000] TCP 200 850 81 0.001 -[...] -``` -Check logs of my-nginx POD: -``` -root@k3s-master:/k3s# kubectl get pods -NAME READY STATUS RESTARTS AGE -my-nginx-65c68bbcdf-xkhqj 1/1 Running 0 90m -``` -``` -kubectl logs my-nginx-65c68bbcdf-xkhqj -f -[...] -10.42.0.18 - - [23/Aug/2020:16:38:33 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.64.0" "-" -[...] -``` - ## Running DaemonSets on `hostPort` * Docs: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ * Good article: https://medium.com/stakater/k8s-deployments-vs-statefulsets-vs-daemonsets-60582f0c62d4 @@ -723,7 +562,7 @@ spec: metadata: labels: app: netcat-daemonset - spec: + spec: containers: - command: - nc @@ -757,4 +596,56 @@ spec: rollingUpdate: maxUnavailable: 1 type: RollingUpdate +``` +## Running StatefulSet with NFS storage +* https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/ +``` +apiVersion: v1 +kind: Service +metadata: + name: nginx + labels: + app: nginx +spec: + ports: + - port: 80 + name: web + clusterIP: None + selector: + app: nginx +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: web +spec: + selector: + matchLabels: + app: nginx + serviceName: "nginx" + replicas: 2 + template: + metadata: + labels: + app: nginx + spec: + terminationGracePeriodSeconds: 10 + containers: + - name: nginx + image: nginx:alpine + ports: + - containerPort: 80 + name: web + volumeMounts: + - name: nfs-backend + mountPath: /nfs-backend + volumeClaimTemplates: + - metadata: + name: nfs-backend + spec: + accessModes: [ "ReadWriteMany" ] + storageClassName: "nfs-client" + resources: + requests: + storage: 32Mi ``` \ No newline at end of file