新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
23
learn/learn-kubernetes-master/kiamol/ch10/proxy/.helmignore
Normal file
23
learn/learn-kubernetes-master/kiamol/ch10/proxy/.helmignore
Normal file
@@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: proxy
|
||||
description: A reverse proxy using Nginx
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: 1.16.0
|
||||
@@ -0,0 +1,45 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-config
|
||||
labels:
|
||||
kiamol: ch10
|
||||
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:10m inactive=24h max_size={{ .Values.cacheMaxSixe }};
|
||||
|
||||
gzip on;
|
||||
gzip_proxied any;
|
||||
|
||||
map $sent_http_content_type $expires {
|
||||
default off;
|
||||
~image/ {{ .Values.imageExpiresDuration }};
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
location / {
|
||||
proxy_pass http://{{ tpl .Values.upstreamToProxy . }};
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache STATIC;
|
||||
proxy_cache_valid 200 1d;
|
||||
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,36 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-proxy
|
||||
labels:
|
||||
kiamol: ch10
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ .Release.Name }}
|
||||
component: proxy
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Release.Name }}
|
||||
component: 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: {{ .Release.Name }}-config
|
||||
- name: cache-volume
|
||||
emptyDir: {}
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-proxy
|
||||
labels:
|
||||
kiamol: ch10
|
||||
spec:
|
||||
ports:
|
||||
- port: {{ .Values.servicePort }}
|
||||
targetPort: http
|
||||
selector:
|
||||
app: {{ .Release.Name }}
|
||||
component: proxy
|
||||
type: {{ .Values.serviceType }}
|
||||
@@ -0,0 +1,6 @@
|
||||
upstreamToProxy: web
|
||||
cacheMaxSixe: 1g
|
||||
imageExpiresDuration: 6M
|
||||
replicaCount: 1
|
||||
servicePort: 8080
|
||||
serviceType: LoadBalancer
|
||||
Reference in New Issue
Block a user