minikube start --memory 4096
minikube addons enable ingress
minikube ip
... shown ip append to/etc/hosts
with host nameissue.test.internal
- kubectl -f resources.yaml apply
- access http://issue.test.internal/info.php
Last active
November 13, 2018 18:02
-
-
Save hidekuro/d2f3788405211446fe98b806bee6fea5 to your computer and use it in GitHub Desktop.
php:7.2-fpm-alpine + nginx:stable-alpine on k8s 検証用リソース
This file contains 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 characters
kind: ConfigMap | |
apiVersion: v1 | |
metadata: | |
name: "nginx-conf-configmap" | |
labels: | |
name: "nginx-conf-configmap" | |
data: | |
site.conf: |- | |
server { | |
server_name issue.test.internal; | |
root /var/www/html; | |
location = /.health { | |
return 200; | |
} | |
location ~ '\.php$' { | |
fastcgi_split_path_info ^(.+?\.php)(|/.*)$; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_pass ${PHP_FPM_HOST}:9000; | |
} | |
} | |
--- | |
kind: ConfigMap | |
apiVersion: v1 | |
metadata: | |
name: "src-configmap" | |
labels: | |
name: "src-configmap" | |
data: | |
info.php: |- | |
<?php | |
phpinfo(); | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: issue-test | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: issue-test | |
template: | |
metadata: | |
labels: | |
app: issue-test | |
spec: | |
volumes: | |
- name: nginx-conf-volume | |
configMap: | |
name: nginx-conf-configmap | |
- name: src-volume | |
configMap: | |
name: src-configmap | |
containers: | |
# php-fpm container | |
- name: php | |
image: php:7.2-fpm-alpine | |
volumeMounts: | |
- mountPath: /var/www/html | |
name: src-volume | |
livenessProbe: | |
tcpSocket: | |
port: 9000 | |
initialDelaySeconds: 30 | |
readinessProbe: | |
tcpSocket: | |
port: 9000 | |
initialDelaySeconds: 30 | |
# nginx container | |
- name: web | |
image: nginx:1.14-alpine | |
ports: | |
- name: http | |
containerPort: 80 | |
protocol: TCP | |
volumeMounts: | |
- name: nginx-conf-volume | |
mountPath: /tmp/nginx-conf | |
env: | |
- name: PHP_FPM_HOST | |
value: "localhost" | |
command: | |
- "sh" | |
- "-c" | |
- "envsubst '$PHP_FPM_HOST' < /tmp/nginx-conf/site.conf > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" | |
livenessProbe: | |
httpGet: | |
port: http | |
path: /.health | |
initialDelaySeconds: 30 | |
readinessProbe: | |
httpGet: | |
port: http | |
path: /.health | |
initialDelaySeconds: 30 | |
resources: | |
limits: | |
cpu: 500m | |
memory: 512Mi | |
requests: | |
cpu: 100m | |
memory: 256Mi | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: issue-test-svc | |
spec: | |
type: ClusterIP | |
ports: | |
- port: 80 | |
targetPort: 80 | |
protocol: TCP | |
name: http | |
selector: | |
app: issue-test | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: issue-test-ing | |
labels: | |
name: issue-test-ing | |
spec: | |
rules: | |
- host: "issue.test.internal" | |
http: | |
paths: | |
- path: / | |
backend: | |
serviceName: issue-test-svc | |
servicePort: http |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment