新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: todo-proxy-configmap
|
||||
labels:
|
||||
kiamol: ch09
|
||||
data:
|
||||
nginx.conf: |-
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:1m inactive=24h max_size=1g;
|
||||
|
||||
gzip on;
|
||||
gzip_proxied any;
|
||||
|
||||
map $sent_http_content_type $expires {
|
||||
default off;
|
||||
~image/ 6M;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
location / {
|
||||
proxy_pass http://todo-web;
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache STATIC;
|
||||
proxy_cache_valid 200 10s;
|
||||
proxy_cache_use_stale error timeout invalid_header updating
|
||||
http_500 http_502 http_503 http_504;
|
||||
add_header X-Cache $upstream_cache_status;
|
||||
add_header X-Host $hostname;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: todo-proxy
|
||||
labels:
|
||||
kiamol: ch09
|
||||
spec:
|
||||
ports:
|
||||
- port: 8091
|
||||
targetPort: 80
|
||||
selector:
|
||||
app: todo-proxy
|
||||
type: LoadBalancer
|
||||
@@ -0,0 +1,33 @@
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: todo-proxy
|
||||
labels:
|
||||
kiamol: ch09
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: todo-proxy
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: todo-proxy
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx:1.17-alpine
|
||||
name: nginx
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: http
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: "/etc/nginx/"
|
||||
readOnly: true
|
||||
- name: cache-volume
|
||||
mountPath: /data/nginx/cache
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: todo-proxy-configmap
|
||||
- name: cache-volume
|
||||
emptyDir: {}
|
||||
@@ -0,0 +1,38 @@
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: todo-proxy
|
||||
labels:
|
||||
kiamol: ch09
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: todo-proxy
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 1
|
||||
minReadySeconds: 90
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: todo-proxy
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx:1.18-alpine
|
||||
name: nginx
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: http
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: "/etc/nginx/"
|
||||
readOnly: true
|
||||
- name: cache-volume
|
||||
mountPath: /data/nginx/cache
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: todo-proxy-configmap
|
||||
- name: cache-volume
|
||||
emptyDir: {}
|
||||
Reference in New Issue
Block a user