您好,登錄后才能下訂單哦!
安全套接字層 (SSL) 證書(有時稱為數(shù)字證書)用于在瀏覽器或用戶計算機與服務(wù)器或網(wǎng)站之間建立加密連接。SSL 連接可保護在每次訪問(稱為會話)期間交換的敏感數(shù)據(jù)(例如信用卡信息),以防被非授權(quán)方攔截。SSL 連接可保護在每次訪問(稱為會話)期間交換的敏感數(shù)據(jù)(例如信用卡信息),以防被非授權(quán)方攔截。
traefik 轉(zhuǎn)發(fā)或者提供的域名都能夠支持https 請求!
K8s 集群
阿里云dns賬戶:(需要讀寫dns服務(wù))
ALICLOUD_ACCESS_KEY
ALICLOUD_SECRET_KEY
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: traefik-outer-ingress-controller
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- ingresses/status
verbs:
- update
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: traefik-outer-ingress-controller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: traefik-outer-ingress-controller
subjects:
- kind: ServiceAccount
name: traefik-outer-ingress-controller
namespace: kube-system
注意: 所有需要啟動traefik的節(jié)點配置標(biāo)簽如下
traefik: "traefik-outer"
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-outer-ingress-controller
namespace: kube-system
---
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: traefik-outer-ingress-controller
namespace: kube-system
labels:
k8s-app: traefik-outer-ingress-lb
spec:
selector:
matchLabels:
k8s-app: traefik-outer-ingress-lb
template:
metadata:
labels:
k8s-app: traefik-outer-ingress-lb
name: traefik-outer-ingress-lb
spec:
serviceAccountName: traefik-outer-ingress-controller
terminationGracePeriodSeconds: 60
hostNetwork: true
containers:
- image: traefik:1.7.19
name: traefik-outer-ingress-lb
env:
- name: ALICLOUD_ACCESS_KEY # 添加環(huán)境變量ALICLOUD_ACCESS_KEY
value: LTAIxxxxxxxxxxxAYfXqk # 阿里云RAM賬號的access_key
- name: ALICLOUD_SECRET_KEY # 添加環(huán)境變量ALICLOUD_SECRET_KEY
value: gfNxxxxxxxxxxxoOslfc # 阿里云RAM賬號的access_secret
resources:
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 1000m
memory: 1024Mi
ports:
- name: http
containerPort: 80
hostPort: 80
- name: https
containerPort: 443
hostPort: 443
- name: admin
containerPort: 8080
hostPort: 8080
args:
- --api
- --kubernetes
- --configfile=/traefik.toml
- --insecureskipverify #如果后端服務(wù)是https協(xié)議時不驗證其證書
- --logLevel=INFO #日志級別
- --defaultEntryPoints=http,https #traefik同時開啟HTTP和HTTPS服務(wù)
- --entrypoints=Name:https Address::443 TLS #HTTPS服務(wù)監(jiān)聽在443端口
- --entrypoints=Name:http Address::80 #HTTPS服務(wù)監(jiān)聽在443端口,與http跳轉(zhuǎn)https配置沖突,只能配置一項;
# - --entrypoints=Name:http Address::80 Redirect.EntryPoint:https #HTTP監(jiān)聽在80端口,并將流量重定向至https
- --acme #開啟證書驗證
- --acme.email=kevin@ptcpt.com #用于注冊的郵箱地址
- --acme.storage=/tmp/acme.json #證書申請臨時文件存儲位置
- --acme.acmeLogging=true #打開日志,方便排錯
- --acme.entryPoint=https #證書類型,必需指向到一個443端口
- --acme.httpchallenge.entrypoint=http # 驗證域名時使用的協(xié)議
- --acme.dnschallenge # 域名驗證方式
- --acme.dnschallenge.provider=alidns # 域名提供商
- --acme.dnschallenge.delaybeforecheck=5 # 驗證域名延時
- --acme.onHostRule=true #自動為acme.entryPoint下的新域名申請證書
- --acme.domains=ptmind.com #要申請證書的域名
- --acme.domains=lingxi365.cn #要申請證書的域名
- --acme.domains=lingxi.link #要申請證書的域名
nodeSelector:
traefik: "traefik-outer"
---
kind: Service
apiVersion: v1
metadata:
name: traefik-outer-ingress-service
namespace: kube-system
spec:
selector:
k8s-app: traefik-outer-ingress-lb
ports:
- protocol: TCP
port: 80
name: web
- protocol: TCP
port: 443
name: https
- protocol: TCP
port: 8080
name: admin
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: traefik-outer-web-ui
namespace: kube-system
spec:
rules:
- host: traefik.ptmind.com #配置管理頁面的域名
http:
paths:
- path: /
backend:
serviceName: traefik-outer-ingress-service
servicePort: admin
--api --kubernetes --configfile=/traefik.toml --insecureskipverify --logLevel=INFO \
--defaultEntryPoints=http,https '--entrypoints=Name:https Address::443 TLS' \
'--entrypoints=Name:http Address::80' --acme --acme.dnschallenge --acme.email=kevin@ptcpt.com \
--acme.storage=/tmp/acme.json --acme.acmeLogging=true --acme.entryPoint=https --acme.httpchallenge.entrypoint=http \
--acme.dnschallenge.provider=alidns --acme.dnschallenge.delaybeforecheck=5 \
--acme.domains=ptmind.com --acme.domains=lingxi365.cn --acme.domains=lingxi.link \
--acme.onHostRule=true
entryPoint = "https"
# 啟用按需證書。如果這個主機名還沒有證書,這將會在與一個主機名發(fā)起請求的第一個TLS握手中向Let's Encrypt請求一個證書。
# 警告,第一次在請求中獲取主機證書會導(dǎo)致TLS握手會非常慢,這會引起Dos***。
# 警告,值得注意的是Let's Encrypt是有請求上限的:https://letsencrypt.org/docs/rate-limits
onDemand = false
# 啟用根據(jù)前端Host規(guī)則來生成證書。這將會為每個具有Host規(guī)則的前端生成一個Let's Encrypt的證書。
# 舉個例子,一個具有規(guī)則的Host:test1.traefik.cn,test2.traefik.cn 將會為主域名test1.traefik.cn與SAN(替代域名) test2.traefik.cn生成一個證書。
onHostRule = true
[acme.httpChallenge]
entryPoint="http"
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。