Last active
February 7, 2021 18:32
-
-
Save Topher-the-Geek/730dcca1808a44247aa338f1a65f28bd to your computer and use it in GitHub Desktop.
Revisions
-
Topher-the-Geek revised this gist
Feb 7, 2021 . No changes.There are no files selected for viewing
-
Topher-the-Geek created this gist
Feb 7, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,87 @@ # Simple PHP app served through AWS Application Load Balancer to Kubernetes cluster. # Assumes you have setup a Kubernetes cluster with AWS Load Balancer Controller and External DNS # https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/ # https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/aws.md # https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/alb-ingress.md # There's a couple place holders near the bottom to be filled in. apiVersion: v1 kind: ConfigMap metadata: name: view-headers labels: k8s-app: view-headers data: index.php: | <html> <head> <title>PHP Test</title> </head> <body> <?php $headers = getallheaders(); foreach($headers as $key=>$val){ echo $key . ': ' . $val . '<br>'; } ?> </body> </html> --- apiVersion: apps/v1 kind: Deployment metadata: name: view-headers spec: selector: matchLabels: run: view-headers replicas: 2 template: metadata: labels: run: view-headers spec: containers: - name: php image: php:7.2-apache ports: - containerPort: 80 volumeMounts: - name: view-headers mountPath: /var/www/html/ volumes: - name: view-headers configMap: name: view-headers --- kind: Service apiVersion: v1 metadata: name: view-headers labels: run: view-headers spec: type: NodePort selector: run: view-headers ports: - port: 80 targetPort: 80 --- apiVersion: extensions/v1beta1 kind: Ingress metadata: name: view-headers annotations: kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/certificate-arn: <Your AWS CertificateManager Cert, or remove this line> spec: rules: - host: view-headers.<Your Route53 Hosted Zone> http: paths: - path: /* backend: serviceName: view-headers servicePort: 80