kubespray 2.24 추가
This commit is contained in:
71
roles/network_plugin/cilium/templates/hubble/config.yml.j2
Normal file
71
roles/network_plugin/cilium/templates/hubble/config.yml.j2
Normal file
@@ -0,0 +1,71 @@
|
||||
#jinja2: trim_blocks:False
|
||||
---
|
||||
# Source: cilium helm chart: cilium/templates/hubble-relay/configmap.yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: hubble-relay-config
|
||||
namespace: kube-system
|
||||
data:
|
||||
config.yaml: |
|
||||
cluster-name: "{{ cilium_cluster_name }}"
|
||||
peer-service: "hubble-peer.kube-system.svc.{{ dns_domain }}:443"
|
||||
listen-address: :4245
|
||||
metrics-listen-address: ":9966"
|
||||
dial-timeout:
|
||||
retry-timeout:
|
||||
sort-buffer-len-max:
|
||||
sort-buffer-drain-timeout:
|
||||
tls-client-cert-file: /var/lib/hubble-relay/tls/client.crt
|
||||
tls-client-key-file: /var/lib/hubble-relay/tls/client.key
|
||||
tls-server-cert-file: /var/lib/hubble-relay/tls/server.crt
|
||||
tls-server-key-file: /var/lib/hubble-relay/tls/server.key
|
||||
tls-hubble-server-ca-files: /var/lib/hubble-relay/tls/hubble-server-ca.crt
|
||||
disable-server-tls: {% if cilium_hubble_tls_generate %}false{% else %}true{% endif %}
|
||||
disable-client-tls: {% if cilium_hubble_tls_generate %}false{% else %}true{% endif %}
|
||||
---
|
||||
# Source: cilium/templates/hubble-ui/configmap.yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: hubble-ui-nginx
|
||||
namespace: kube-system
|
||||
data:
|
||||
nginx.conf: |
|
||||
server {
|
||||
listen 8081;
|
||||
{% if cilium_enable_ipv6 %}
|
||||
listen [::]:8081;
|
||||
{% endif %}
|
||||
server_name localhost;
|
||||
root /app;
|
||||
index index.html;
|
||||
client_max_body_size 1G;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
# CORS
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, HEAD, DELETE, OPTIONS";
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Access-Control-Max-Age 1728000;
|
||||
add_header Access-Control-Expose-Headers content-length,grpc-status,grpc-message;
|
||||
add_header Access-Control-Allow-Headers range,keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout;
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
# /CORS
|
||||
|
||||
location /api {
|
||||
proxy_http_version 1.1;
|
||||
proxy_pass_request_headers on;
|
||||
proxy_hide_header Access-Control-Allow-Origin;
|
||||
proxy_pass http://127.0.0.1:8090;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
}
|
||||
106
roles/network_plugin/cilium/templates/hubble/cr.yml.j2
Normal file
106
roles/network_plugin/cilium/templates/hubble/cr.yml.j2
Normal file
@@ -0,0 +1,106 @@
|
||||
{% if cilium_hubble_tls_generate %}
|
||||
---
|
||||
# Source: cilium/templates/hubble-generate-certs-clusterrole.yaml
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: hubble-generate-certs
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
- configmaps
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
resourceNames:
|
||||
- hubble-server-certs
|
||||
- hubble-relay-client-certs
|
||||
- hubble-relay-server-certs
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
resourceNames:
|
||||
- hubble-ca-cert
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
resourceNames:
|
||||
- hubble-ca-secret
|
||||
verbs:
|
||||
- get
|
||||
{% endif %}
|
||||
---
|
||||
# Source: cilium/templates/hubble-relay-clusterrole.yaml
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: hubble-relay
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- componentstatuses
|
||||
- endpoints
|
||||
- namespaces
|
||||
- nodes
|
||||
- pods
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
# Source: cilium/templates/hubble-ui-clusterrole.yaml
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: hubble-ui
|
||||
rules:
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- networkpolicies
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- componentstatuses
|
||||
- endpoints
|
||||
- namespaces
|
||||
- nodes
|
||||
- pods
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- "*"
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
44
roles/network_plugin/cilium/templates/hubble/crb.yml.j2
Normal file
44
roles/network_plugin/cilium/templates/hubble/crb.yml.j2
Normal file
@@ -0,0 +1,44 @@
|
||||
{% if cilium_hubble_tls_generate %}
|
||||
---
|
||||
# Source: cilium/templates/hubble-generate-certs-clusterrolebinding.yaml
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: hubble-generate-certs
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: hubble-generate-certs
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: hubble-generate-certs
|
||||
namespace: kube-system
|
||||
{% endif %}
|
||||
---
|
||||
# Source: cilium/templates/hubble-relay-clusterrolebinding.yaml
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: hubble-relay
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: hubble-relay
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
namespace: kube-system
|
||||
name: hubble-relay
|
||||
---
|
||||
# Source: cilium/templates/hubble-ui-clusterrolebinding.yaml
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: hubble-ui
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: hubble-ui
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
namespace: kube-system
|
||||
name: hubble-ui
|
||||
38
roles/network_plugin/cilium/templates/hubble/cronjob.yml.j2
Normal file
38
roles/network_plugin/cilium/templates/hubble/cronjob.yml.j2
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
# Source: cilium/templates/hubble-generate-certs-cronjob.yaml
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: hubble-generate-certs
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: hubble-generate-certs
|
||||
spec:
|
||||
schedule: "0 0 1 */4 *"
|
||||
concurrencyPolicy: Forbid
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: hubble-generate-certs
|
||||
spec:
|
||||
serviceAccount: hubble-generate-certs
|
||||
serviceAccountName: hubble-generate-certs
|
||||
containers:
|
||||
- name: certgen
|
||||
image: "{{ cilium_hubble_certgen_image_repo }}:{{ cilium_hubble_certgen_image_tag }}"
|
||||
imagePullPolicy: {{ k8s_image_pull_policy }}
|
||||
command:
|
||||
- "/usr/bin/cilium-certgen"
|
||||
# Because this is executed as a job, we pass the values as command
|
||||
# line args instead of via config map. This allows users to inspect
|
||||
# the values used in past runs by inspecting the completed pod.
|
||||
args:
|
||||
{% for key, value in cilium_certgen_args.items() -%}
|
||||
- "--{{ key }}={{ value }}"
|
||||
{% endfor %}
|
||||
|
||||
hostNetwork: true
|
||||
restartPolicy: OnFailure
|
||||
ttlSecondsAfterFinished: 1800
|
||||
197
roles/network_plugin/cilium/templates/hubble/deploy.yml.j2
Normal file
197
roles/network_plugin/cilium/templates/hubble/deploy.yml.j2
Normal file
@@ -0,0 +1,197 @@
|
||||
---
|
||||
# Source: cilium/templates/hubble-relay-deployment.yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hubble-relay
|
||||
labels:
|
||||
k8s-app: hubble-relay
|
||||
namespace: kube-system
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: hubble-relay
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxUnavailable: 1
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
labels:
|
||||
k8s-app: hubble-relay
|
||||
spec:
|
||||
affinity:
|
||||
podAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: "k8s-app"
|
||||
operator: In
|
||||
values:
|
||||
- cilium
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
containers:
|
||||
- name: hubble-relay
|
||||
image: "{{ cilium_hubble_relay_image_repo }}:{{ cilium_hubble_relay_image_tag }}"
|
||||
imagePullPolicy: {{ k8s_image_pull_policy }}
|
||||
command:
|
||||
- hubble-relay
|
||||
args:
|
||||
- serve
|
||||
ports:
|
||||
- name: grpc
|
||||
containerPort: 4245
|
||||
{% if cilium_enable_prometheus %}
|
||||
- name: prometheus
|
||||
containerPort: 9966
|
||||
protocol: TCP
|
||||
{% endif %}
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: grpc
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: grpc
|
||||
volumeMounts:
|
||||
- mountPath: /var/run/cilium
|
||||
name: hubble-sock-dir
|
||||
readOnly: true
|
||||
- mountPath: /etc/hubble-relay
|
||||
name: config
|
||||
readOnly: true
|
||||
{% if cilium_hubble_tls_generate -%}
|
||||
- mountPath: /var/lib/hubble-relay/tls
|
||||
name: tls
|
||||
readOnly: true
|
||||
{%- endif %}
|
||||
|
||||
restartPolicy: Always
|
||||
serviceAccount: hubble-relay
|
||||
serviceAccountName: hubble-relay
|
||||
terminationGracePeriodSeconds: 0
|
||||
volumes:
|
||||
- configMap:
|
||||
name: hubble-relay-config
|
||||
items:
|
||||
- key: config.yaml
|
||||
path: config.yaml
|
||||
name: config
|
||||
- hostPath:
|
||||
path: /var/run/cilium
|
||||
type: Directory
|
||||
name: hubble-sock-dir
|
||||
{% if cilium_hubble_tls_generate -%}
|
||||
- projected:
|
||||
sources:
|
||||
- secret:
|
||||
name: hubble-relay-client-certs
|
||||
items:
|
||||
- key: ca.crt
|
||||
path: hubble-server-ca.crt
|
||||
- key: tls.crt
|
||||
path: client.crt
|
||||
- key: tls.key
|
||||
path: client.key
|
||||
- secret:
|
||||
name: hubble-server-certs
|
||||
items:
|
||||
- key: tls.crt
|
||||
path: server.crt
|
||||
- key: tls.key
|
||||
path: server.key
|
||||
name: tls
|
||||
{%- endif %}
|
||||
|
||||
---
|
||||
# Source: cilium/templates/hubble-ui/deployment.yaml
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: hubble-ui
|
||||
name: hubble-ui
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: hubble-ui
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
labels:
|
||||
k8s-app: hubble-ui
|
||||
spec:
|
||||
securityContext:
|
||||
runAsUser: 1001
|
||||
serviceAccount: hubble-ui
|
||||
serviceAccountName: hubble-ui
|
||||
containers:
|
||||
- name: frontend
|
||||
image: "{{ cilium_hubble_ui_image_repo }}:{{ cilium_hubble_ui_image_tag }}"
|
||||
imagePullPolicy: {{ k8s_image_pull_policy }}
|
||||
ports:
|
||||
- containerPort: 8081
|
||||
name: http
|
||||
volumeMounts:
|
||||
- name: hubble-ui-nginx-conf
|
||||
mountPath: /etc/nginx/conf.d/default.conf
|
||||
subPath: nginx.conf
|
||||
- name: tmp-dir
|
||||
mountPath: /tmp
|
||||
resources:
|
||||
{}
|
||||
- name: backend
|
||||
image: "{{ cilium_hubble_ui_backend_image_repo }}:{{ cilium_hubble_ui_backend_image_tag }}"
|
||||
imagePullPolicy: {{ k8s_image_pull_policy }}
|
||||
env:
|
||||
- name: EVENTS_SERVER_PORT
|
||||
value: "8090"
|
||||
{% if cilium_hubble_tls_generate -%}
|
||||
- name: TLS_TO_RELAY_ENABLED
|
||||
value: "true"
|
||||
- name: FLOWS_API_ADDR
|
||||
value: "hubble-relay:443"
|
||||
- name: TLS_RELAY_SERVER_NAME
|
||||
value: ui.{{ cilium_cluster_name }}.hubble-grpc.cilium.io
|
||||
- name: TLS_RELAY_CA_CERT_FILES
|
||||
value: /var/lib/hubble-ui/certs/hubble-server-ca.crt
|
||||
- name: TLS_RELAY_CLIENT_CERT_FILE
|
||||
value: /var/lib/hubble-ui/certs/client.crt
|
||||
- name: TLS_RELAY_CLIENT_KEY_FILE
|
||||
value: /var/lib/hubble-ui/certs/client.key
|
||||
{% else -%}
|
||||
- name: FLOWS_API_ADDR
|
||||
value: "hubble-relay:80"
|
||||
{% endif %}
|
||||
|
||||
volumeMounts:
|
||||
- name: tls
|
||||
mountPath: /var/lib/hubble-ui/certs
|
||||
readOnly: true
|
||||
ports:
|
||||
- containerPort: 8090
|
||||
name: grpc
|
||||
resources:
|
||||
{}
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: hubble-ui-nginx
|
||||
name: hubble-ui-nginx-conf
|
||||
- projected:
|
||||
sources:
|
||||
- secret:
|
||||
name: hubble-relay-client-certs
|
||||
items:
|
||||
- key: ca.crt
|
||||
path: hubble-server-ca.crt
|
||||
- key: tls.crt
|
||||
path: client.crt
|
||||
- key: tls.key
|
||||
path: client.key
|
||||
name: tls
|
||||
- emptyDir: {}
|
||||
name: tmp-dir
|
||||
34
roles/network_plugin/cilium/templates/hubble/job.yml.j2
Normal file
34
roles/network_plugin/cilium/templates/hubble/job.yml.j2
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
# Source: cilium/templates/hubble-generate-certs-job.yaml
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: hubble-generate-certs
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: hubble-generate-certs
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: hubble-generate-certs
|
||||
spec:
|
||||
serviceAccount: hubble-generate-certs
|
||||
serviceAccountName: hubble-generate-certs
|
||||
containers:
|
||||
- name: certgen
|
||||
image: "{{ cilium_hubble_certgen_image_repo }}:{{ cilium_hubble_certgen_image_tag }}"
|
||||
imagePullPolicy: {{ k8s_image_pull_policy }}
|
||||
command:
|
||||
- "/usr/bin/cilium-certgen"
|
||||
# Because this is executed as a job, we pass the values as command
|
||||
# line args instead of via config map. This allows users to inspect
|
||||
# the values used in past runs by inspecting the completed pod.
|
||||
args:
|
||||
{% for key, value in cilium_certgen_args.items() -%}
|
||||
- "--{{ key }}={{ value }}"
|
||||
{% endfor %}
|
||||
|
||||
hostNetwork: true
|
||||
restartPolicy: OnFailure
|
||||
ttlSecondsAfterFinished: 1800
|
||||
23
roles/network_plugin/cilium/templates/hubble/sa.yml.j2
Normal file
23
roles/network_plugin/cilium/templates/hubble/sa.yml.j2
Normal file
@@ -0,0 +1,23 @@
|
||||
{% if cilium_hubble_tls_generate %}
|
||||
---
|
||||
# Source: cilium/templates/hubble-generate-certs-serviceaccount.yaml
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: hubble-generate-certs
|
||||
namespace: kube-system
|
||||
{% endif %}
|
||||
---
|
||||
# Source: cilium/templates/hubble-relay-serviceaccount.yaml
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: hubble-relay
|
||||
namespace: kube-system
|
||||
---
|
||||
# Source: cilium/templates/hubble-ui-serviceaccount.yaml
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: hubble-ui
|
||||
namespace: kube-system
|
||||
105
roles/network_plugin/cilium/templates/hubble/service.yml.j2
Normal file
105
roles/network_plugin/cilium/templates/hubble/service.yml.j2
Normal file
@@ -0,0 +1,105 @@
|
||||
{% if cilium_enable_prometheus or cilium_enable_hubble_metrics %}
|
||||
---
|
||||
# Source: cilium/templates/cilium-agent-service.yaml
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: hubble-metrics
|
||||
namespace: kube-system
|
||||
annotations:
|
||||
prometheus.io/scrape: 'true'
|
||||
prometheus.io/port: "{{ cilium_hubble_scrape_port }}"
|
||||
labels:
|
||||
k8s-app: hubble
|
||||
spec:
|
||||
clusterIP: None
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: hubble-metrics
|
||||
port: 9091
|
||||
protocol: TCP
|
||||
targetPort: hubble-metrics
|
||||
selector:
|
||||
k8s-app: cilium
|
||||
---
|
||||
# Source: cilium/templates/hubble-relay/metrics-service.yaml
|
||||
# We use a separate service from hubble-relay which can be exposed externally
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: hubble-relay-metrics
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: hubble-relay
|
||||
annotations:
|
||||
prometheus.io/scrape: 'true'
|
||||
prometheus.io/port: "9966"
|
||||
spec:
|
||||
clusterIP: None
|
||||
type: ClusterIP
|
||||
selector:
|
||||
k8s-app: hubble-relay
|
||||
ports:
|
||||
- name: metrics
|
||||
port: 9966
|
||||
protocol: TCP
|
||||
targetPort: prometheus
|
||||
|
||||
{% endif %}
|
||||
---
|
||||
# Source: cilium/templates/hubble-relay-service.yaml
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: hubble-relay
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: hubble-relay
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
k8s-app: hubble-relay
|
||||
ports:
|
||||
- protocol: TCP
|
||||
{% if cilium_hubble_tls_generate -%}
|
||||
port: 443
|
||||
{% else -%}
|
||||
port: 80
|
||||
{% endif -%}
|
||||
targetPort: 4245
|
||||
---
|
||||
# Source: cilium/templates/hubble-ui-service.yaml
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: hubble-ui
|
||||
labels:
|
||||
k8s-app: hubble-ui
|
||||
namespace: kube-system
|
||||
spec:
|
||||
selector:
|
||||
k8s-app: hubble-ui
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 8081
|
||||
type: ClusterIP
|
||||
---
|
||||
# Source: cilium/templates/hubble/peer-service.yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hubble-peer
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: cilium
|
||||
spec:
|
||||
selector:
|
||||
k8s-app: cilium
|
||||
ports:
|
||||
- name: peer-service
|
||||
port: 443
|
||||
protocol: TCP
|
||||
targetPort: 4244
|
||||
internalTrafficPolicy: Local
|
||||
|
||||
Reference in New Issue
Block a user