修改 traefik-controller 配置

pull/447/head
gjmzj 2019-01-18 17:06:03 +08:00
parent e6b73369d2
commit 407dbce345
3 changed files with 35 additions and 1 deletions

View File

@ -1,3 +1,4 @@
# kubectl run test-hello --image=nginx --expose --port=80
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:

View File

@ -11,9 +11,12 @@ data:
[entryPoints] [entryPoints]
[entryPoints.http] [entryPoints.http]
address = ":80" address = ":80"
# 配置http 强制跳转 https ### 配置http 强制跳转 https
#[entryPoints.http.redirect] #[entryPoints.http.redirect]
# entryPoint = "https" # entryPoint = "https"
### 配置只信任trustedIPs传递过来X-Forwarded-*,默认全部信任;为了防止客户端地址伪造,需开启这个
#[entryPoints.http.forwardedHeaders]
# trustedIPs = ["10.1.0.0/16", "172.20.0.0/16", "192.168.1.3"]
[entryPoints.https] [entryPoints.https]
address = ":443" address = ":443"
[entryPoints.https.tls] [entryPoints.https.tls]
@ -48,6 +51,8 @@ spec:
- name: config - name: config
configMap: configMap:
name: traefik-conf name: traefik-conf
#nodeSelector:
# node-role.kubernetes.io/traefik: "true"
containers: containers:
- image: traefik:v1.7.4 - image: traefik:v1.7.4
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
@ -69,6 +74,19 @@ spec:
- --api - --api
- --kubernetes - --kubernetes
- --logLevel=INFO - --logLevel=INFO
securityContext:
capabilities:
drop:
- ALL
add:
- NET_BIND_SERVICE
ports:
- name: http
containerPort: 80
hostPort: 80
- name: https
containerPort: 443
hostPort: 443
--- ---
kind: Service kind: Service
apiVersion: v1 apiVersion: v1

View File

@ -0,0 +1,15 @@
# kubectl run whoami --image=emilevauge/whoami --port=80 --expose
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test-whoami
spec:
rules:
- host: who.test.com
http:
paths:
- path: /
backend:
serviceName: whoami
servicePort: 80