| @ -0,0 +1,33 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: app-helloworld-two | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: app-helloworld-two | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: app-helloworld-two | |||||
| spec: | |||||
| containers: | |||||
| - name: app-helloworld-two | |||||
| image: nginx | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| env: | |||||
| - name: TITLE | |||||
| value: "Welcome to Azure Kubernetes Service (AKS)" | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: app-helloworld-two | |||||
| spec: | |||||
| type: ClusterIP | |||||
| ports: | |||||
| - port: 80 | |||||
| selector: | |||||
| app: app-helloworld-two | |||||
| @ -0,0 +1,33 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: app-helloworld-one | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: app-helloworld-one | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: app-helloworld-one | |||||
| spec: | |||||
| containers: | |||||
| - name: app-helloworld-one | |||||
| image: nginx | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| env: | |||||
| - name: TITLE | |||||
| value: "Welcome to Azure Kubernetes Service (AKS)" | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: app-helloworld-one | |||||
| spec: | |||||
| type: ClusterIP | |||||
| ports: | |||||
| - port: 80 | |||||
| selector: | |||||
| app: app-helloworld-one | |||||
| @ -0,0 +1,4 @@ | |||||
| kubectl create -f pv-local-dos.yaml | |||||
| kubectl create -f pv-local-uno.yaml | |||||
| kubectl create -k ./ | |||||
| #watch kubectl get all | |||||
| @ -0,0 +1,61 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: hello-dos | |||||
| spec: | |||||
| type: ClusterIP | |||||
| ports: | |||||
| - name: http | |||||
| port: 80 | |||||
| selector: | |||||
| app: hello-dos | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| name: hello-dos-pv-claim | |||||
| labels: | |||||
| app: hello-dos | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteMany | |||||
| storageClassName: "" | |||||
| resources: | |||||
| requests: | |||||
| storage: 2Gi | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: hello-dos | |||||
| labels: | |||||
| app: hello-dos | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: hello-dos | |||||
| tier: frontend | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: hello-dos | |||||
| tier: frontend | |||||
| spec: | |||||
| containers: | |||||
| - name: hello-dos | |||||
| #image: linuxserver/nginx | |||||
| image: docker-registry:32000/minginx:2.0 | |||||
| #image: httpd | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| volumeMounts: | |||||
| - name: hello-dos-folder | |||||
| mountPath: /usr/share/nginx/html | |||||
| imagePullSecrets: | |||||
| - name: reg-cred-secret | |||||
| volumes: | |||||
| - name: hello-dos-folder | |||||
| persistentVolumeClaim: | |||||
| claimName: hello-dos-pv-claim | |||||
| @ -0,0 +1 @@ | |||||
| kubectl exec -ti deployment.apps/app-helloworld-one -- /bin/bash | |||||
| @ -0,0 +1 @@ | |||||
| kubectl exec -ti deployment.apps/app-helloworld-two -- /bin/bash | |||||
| @ -0,0 +1,36 @@ | |||||
| apiVersion: networking.k8s.io/v1 | |||||
| kind: Ingress | |||||
| metadata: | |||||
| name: hello-world-ingress | |||||
| annotations: | |||||
| nginx.ingress.kubernetes.io/ssl-redirect: "false" | |||||
| nginx.ingress.kubernetes.io/use-regex: "true" | |||||
| nginx.ingress.kubernetes.io/rewrite-target: /$2 | |||||
| spec: | |||||
| ingressClassName: nginx | |||||
| rules: | |||||
| - host: k8s-server | |||||
| http: | |||||
| paths: | |||||
| - path: /hello-world-one(/|$)(.*) | |||||
| pathType: Prefix | |||||
| backend: | |||||
| service: | |||||
| name: hello-uno | |||||
| port: | |||||
| number: 80 | |||||
| - path: /hello-world-two(/|$)(.*) | |||||
| pathType: Prefix | |||||
| backend: | |||||
| service: | |||||
| name: hello-dos | |||||
| port: | |||||
| number: 80 | |||||
| - path: /(.*) | |||||
| pathType: Prefix | |||||
| backend: | |||||
| service: | |||||
| name: hello-uno | |||||
| port: | |||||
| number: 80 | |||||
| @ -0,0 +1,4 @@ | |||||
| resources: | |||||
| - uno-deployment.yaml | |||||
| - dos-deployment.yaml | |||||
| - ingress.yaml | |||||
| @ -0,0 +1,3 @@ | |||||
| kubectl delete -k ./ | |||||
| kubectl delete -f pv-local-uno.yaml | |||||
| kubectl delete -f pv-local-dos.yaml | |||||
| @ -0,0 +1,11 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: hello-dos-folder | |||||
| spec: | |||||
| capacity: | |||||
| storage: 2Gi | |||||
| accessModes: | |||||
| - ReadWriteMany | |||||
| hostPath: | |||||
| path: "/mnt/cluster/hello/dos" | |||||
| @ -0,0 +1,11 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: hello-uno-folder | |||||
| spec: | |||||
| capacity: | |||||
| storage: 2Gi | |||||
| accessModes: | |||||
| - ReadWriteMany | |||||
| hostPath: | |||||
| path: "/mnt/cluster/hello/uno" | |||||
| @ -0,0 +1,61 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: hello-uno | |||||
| spec: | |||||
| type: ClusterIP | |||||
| ports: | |||||
| - name: http | |||||
| port: 80 | |||||
| selector: | |||||
| app: hello-uno | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| name: hello-uno-pv-claim | |||||
| labels: | |||||
| app: hello-uno | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteMany | |||||
| storageClassName: "" | |||||
| resources: | |||||
| requests: | |||||
| storage: 2Gi | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: hello-uno | |||||
| labels: | |||||
| app: hello-uno | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: hello-uno | |||||
| tier: frontend | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: hello-uno | |||||
| tier: frontend | |||||
| spec: | |||||
| containers: | |||||
| - name: hello-uno | |||||
| #image: linuxserver/nginx | |||||
| image: docker-registry:32000/minginx:2.0 | |||||
| #image: httpd | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| volumeMounts: | |||||
| - name: hello-uno-folder | |||||
| mountPath: /usr/share/nginx/html | |||||
| imagePullSecrets: | |||||
| - name: reg-cred-secret | |||||
| volumes: | |||||
| - name: hello-uno-folder | |||||
| persistentVolumeClaim: | |||||
| claimName: hello-uno-pv-claim | |||||
| @ -0,0 +1,64 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: nginx-example | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: http | |||||
| port: 80 | |||||
| nodePort: 30080 | |||||
| targetPort: nginx-http | |||||
| selector: | |||||
| app: nginx | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| name: nginx-pv-claim | |||||
| labels: | |||||
| app: nginx | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteMany | |||||
| storageClassName: "" | |||||
| resources: | |||||
| requests: | |||||
| storage: 2Gi | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: nginx-example | |||||
| labels: | |||||
| app: nginx | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: nginx | |||||
| tier: frontend | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: nginx | |||||
| tier: frontend | |||||
| spec: | |||||
| containers: | |||||
| - name: nginx | |||||
| #image: linuxserver/nginx | |||||
| image: docker-registry:32000/minginx:2.0 | |||||
| #image: httpd | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| name: "nginx-http" | |||||
| volumeMounts: | |||||
| - name: nginx-www-folder | |||||
| mountPath: /usr/share/nginx/html | |||||
| imagePullSecrets: | |||||
| - name: reg-cred-secret | |||||
| volumes: | |||||
| - name: nginx-www-folder | |||||
| persistentVolumeClaim: | |||||
| claimName: nginx-pv-claim | |||||