From 0e17dd90987491f6b06104a3ee886aa3b3475d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=8C=E9=A2=A0?= Date: Fri, 27 Mar 2020 19:56:23 +0800 Subject: [PATCH] sync yaml py Dockerfile json with /en (#19882) --- .../zh/examples/admin/cloud/ccm-example.yaml | 138 ++-- .../admin/dns/dns-horizontal-autoscaler.yaml | 66 +- content/zh/examples/admin/dns/dnsutils.yaml | 28 +- content/zh/examples/admin/namespace-dev.json | 2 +- content/zh/examples/admin/namespace-prod.json | 2 +- .../admin/resource/quota-mem-cpu-pod-2.yaml | 4 +- .../admin/resource/quota-mem-cpu-pod.yaml | 4 +- .../zh/examples/admin/sched/my-scheduler.yaml | 134 ++-- .../application/job/rabbitmq/Dockerfile | 2 +- .../application/job/rabbitmq/worker.py | 2 +- .../examples/application/job/redis/rediswq.py | 2 +- .../examples/application/job/redis/worker.py | 4 +- .../zh/examples/controllers/daemonset.yaml | 88 +- content/zh/examples/controllers/frontend.yaml | 42 +- .../controllers/nginx-deployment.yaml | 42 +- .../controllers/replication-nginx-1.14.2.yaml | 32 +- .../controllers/replication-nginx-1.16.1.yaml | 42 +- .../examples/debug/fluentd-gcp-configmap.yaml | 758 +++++++++--------- content/zh/examples/examples_test.go | 16 +- content/zh/examples/minikube/Dockerfile | 2 +- .../examples/podpreset/allow-db-merged.yaml | 62 +- content/zh/examples/podpreset/allow-db.yaml | 48 +- .../zh/examples/policy/restricted-psp.yaml | 96 +-- .../service/access/hello-service.yaml | 24 +- .../examples/service/networking/ingress.yaml | 18 +- .../service/networking/nginx-secure-app.yaml | 102 +-- content/zh/examples/windows/emptydir-pod.yaml | 40 +- .../windows/run-as-username-container.yaml | 34 +- .../examples/windows/run-as-username-pod.yaml | 28 +- 29 files changed, 926 insertions(+), 936 deletions(-) diff --git a/content/zh/examples/admin/cloud/ccm-example.yaml b/content/zh/examples/admin/cloud/ccm-example.yaml index 27386be675..20aafb31e5 100644 --- a/content/zh/examples/admin/cloud/ccm-example.yaml +++ b/content/zh/examples/admin/cloud/ccm-example.yaml @@ -1,69 +1,69 @@ -# This is an example of how to setup cloud-controller-manger as a Daemonset in your cluster. -# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master -# Note that this Daemonset will not work straight out of the box for your cloud, this is -# meant to be a guideline. - ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: cloud-controller-manager - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: system:cloud-controller-manager -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: cluster-admin -subjects: -- kind: ServiceAccount - name: cloud-controller-manager - namespace: kube-system ---- -apiVersion: apps/v1 -kind: DaemonSet -metadata: - labels: - k8s-app: cloud-controller-manager - name: cloud-controller-manager - namespace: kube-system -spec: - selector: - matchLabels: - k8s-app: cloud-controller-manager - template: - metadata: - labels: - k8s-app: cloud-controller-manager - spec: - serviceAccountName: cloud-controller-manager - containers: - - name: cloud-controller-manager - # for in-tree providers we use k8s.gcr.io/cloud-controller-manager - # this can be replaced with any other image for out-of-tree providers - image: k8s.gcr.io/cloud-controller-manager:v1.8.0 - command: - - /usr/local/bin/cloud-controller-manager - - --cloud-provider=[YOUR_CLOUD_PROVIDER] # Add your own cloud provider here! - - --leader-elect=true - - --use-service-account-credentials - # these flags will vary for every cloud provider - - --allocate-node-cidrs=true - - --configure-cloud-routes=true - - --cluster-cidr=172.17.0.0/16 - tolerations: - # this is required so CCM can bootstrap itself - - key: node.cloudprovider.kubernetes.io/uninitialized - value: "true" - effect: NoSchedule - # this is to have the daemonset runnable on master nodes - # the taint may vary depending on your cluster setup - - key: node-role.kubernetes.io/master - effect: NoSchedule - # this is to restrict CCM to only run on master nodes - # the node selector may vary depending on your cluster setup - nodeSelector: - node-role.kubernetes.io/master: "" +# This is an example of how to setup cloud-controller-manger as a Daemonset in your cluster. +# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master +# Note that this Daemonset will not work straight out of the box for your cloud, this is +# meant to be a guideline. + +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: cloud-controller-manager + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: system:cloud-controller-manager +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +subjects: +- kind: ServiceAccount + name: cloud-controller-manager + namespace: kube-system +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + k8s-app: cloud-controller-manager + name: cloud-controller-manager + namespace: kube-system +spec: + selector: + matchLabels: + k8s-app: cloud-controller-manager + template: + metadata: + labels: + k8s-app: cloud-controller-manager + spec: + serviceAccountName: cloud-controller-manager + containers: + - name: cloud-controller-manager + # for in-tree providers we use k8s.gcr.io/cloud-controller-manager + # this can be replaced with any other image for out-of-tree providers + image: k8s.gcr.io/cloud-controller-manager:v1.8.0 + command: + - /usr/local/bin/cloud-controller-manager + - --cloud-provider=[YOUR_CLOUD_PROVIDER] # Add your own cloud provider here! + - --leader-elect=true + - --use-service-account-credentials + # these flags will vary for every cloud provider + - --allocate-node-cidrs=true + - --configure-cloud-routes=true + - --cluster-cidr=172.17.0.0/16 + tolerations: + # this is required so CCM can bootstrap itself + - key: node.cloudprovider.kubernetes.io/uninitialized + value: "true" + effect: NoSchedule + # this is to have the daemonset runnable on master nodes + # the taint may vary depending on your cluster setup + - key: node-role.kubernetes.io/master + effect: NoSchedule + # this is to restrict CCM to only run on master nodes + # the node selector may vary depending on your cluster setup + nodeSelector: + node-role.kubernetes.io/master: "" diff --git a/content/zh/examples/admin/dns/dns-horizontal-autoscaler.yaml b/content/zh/examples/admin/dns/dns-horizontal-autoscaler.yaml index 3676a0acdb..dff87cf851 100644 --- a/content/zh/examples/admin/dns/dns-horizontal-autoscaler.yaml +++ b/content/zh/examples/admin/dns/dns-horizontal-autoscaler.yaml @@ -1,33 +1,33 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: dns-autoscaler - namespace: kube-system - labels: - k8s-app: dns-autoscaler -spec: - selector: - matchLabels: - k8s-app: dns-autoscaler - template: - metadata: - labels: - k8s-app: dns-autoscaler - spec: - containers: - - name: autoscaler - image: k8s.gcr.io/cluster-proportional-autoscaler-amd64:1.6.0 - resources: - requests: - cpu: 20m - memory: 10Mi - command: - - /cluster-proportional-autoscaler - - --namespace=kube-system - - --configmap=dns-autoscaler - - --target= - # When cluster is using large nodes(with more cores), "coresPerReplica" should dominate. - # If using small nodes, "nodesPerReplica" should dominate. - - --default-params={"linear":{"coresPerReplica":256,"nodesPerReplica":16,"min":1}} - - --logtostderr=true - - --v=2 +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dns-autoscaler + namespace: kube-system + labels: + k8s-app: dns-autoscaler +spec: + selector: + matchLabels: + k8s-app: dns-autoscaler + template: + metadata: + labels: + k8s-app: dns-autoscaler + spec: + containers: + - name: autoscaler + image: k8s.gcr.io/cluster-proportional-autoscaler-amd64:1.6.0 + resources: + requests: + cpu: 20m + memory: 10Mi + command: + - /cluster-proportional-autoscaler + - --namespace=kube-system + - --configmap=dns-autoscaler + - --target= + # When cluster is using large nodes(with more cores), "coresPerReplica" should dominate. + # If using small nodes, "nodesPerReplica" should dominate. + - --default-params={"linear":{"coresPerReplica":256,"nodesPerReplica":16,"min":1}} + - --logtostderr=true + - --v=2 diff --git a/content/zh/examples/admin/dns/dnsutils.yaml b/content/zh/examples/admin/dns/dnsutils.yaml index 5eb9833f39..9192bf3502 100644 --- a/content/zh/examples/admin/dns/dnsutils.yaml +++ b/content/zh/examples/admin/dns/dnsutils.yaml @@ -1,14 +1,14 @@ -apiVersion: v1 -kind: Pod -metadata: - name: dnsutils - namespace: default -spec: - containers: - - name: dnsutils - image: gcr.io/kubernetes-e2e-test-images/dnsutils:1.3 - command: - - sleep - - "3600" - imagePullPolicy: IfNotPresent - restartPolicy: Always +apiVersion: v1 +kind: Pod +metadata: + name: dnsutils + namespace: default +spec: + containers: + - name: dnsutils + image: gcr.io/kubernetes-e2e-test-images/dnsutils:1.3 + command: + - sleep + - "3600" + imagePullPolicy: IfNotPresent + restartPolicy: Always diff --git a/content/zh/examples/admin/namespace-dev.json b/content/zh/examples/admin/namespace-dev.json index b2b43b0b73..cb3ed7cdc1 100644 --- a/content/zh/examples/admin/namespace-dev.json +++ b/content/zh/examples/admin/namespace-dev.json @@ -1,6 +1,6 @@ { - "kind": "Namespace", "apiVersion": "v1", + "kind": "Namespace", "metadata": { "name": "development", "labels": { diff --git a/content/zh/examples/admin/namespace-prod.json b/content/zh/examples/admin/namespace-prod.json index d4503f1ac1..878ba7866c 100644 --- a/content/zh/examples/admin/namespace-prod.json +++ b/content/zh/examples/admin/namespace-prod.json @@ -1,6 +1,6 @@ { - "kind": "Namespace", "apiVersion": "v1", + "kind": "Namespace", "metadata": { "name": "production", "labels": { diff --git a/content/zh/examples/admin/resource/quota-mem-cpu-pod-2.yaml b/content/zh/examples/admin/resource/quota-mem-cpu-pod-2.yaml index 580bcdf970..22726c600a 100644 --- a/content/zh/examples/admin/resource/quota-mem-cpu-pod-2.yaml +++ b/content/zh/examples/admin/resource/quota-mem-cpu-pod-2.yaml @@ -9,8 +9,8 @@ spec: resources: limits: memory: "1Gi" - cpu: "800m" + cpu: "800m" requests: memory: "700Mi" cpu: "400m" - + diff --git a/content/zh/examples/admin/resource/quota-mem-cpu-pod.yaml b/content/zh/examples/admin/resource/quota-mem-cpu-pod.yaml index c8967d93f5..ba27bf5ccf 100644 --- a/content/zh/examples/admin/resource/quota-mem-cpu-pod.yaml +++ b/content/zh/examples/admin/resource/quota-mem-cpu-pod.yaml @@ -9,8 +9,8 @@ spec: resources: limits: memory: "800Mi" - cpu: "800m" + cpu: "800m" requests: memory: "600Mi" cpu: "400m" - + diff --git a/content/zh/examples/admin/sched/my-scheduler.yaml b/content/zh/examples/admin/sched/my-scheduler.yaml index 4903c6f54c..a2ccc08da5 100644 --- a/content/zh/examples/admin/sched/my-scheduler.yaml +++ b/content/zh/examples/admin/sched/my-scheduler.yaml @@ -1,67 +1,67 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: my-scheduler - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: my-scheduler-as-kube-scheduler -subjects: -- kind: ServiceAccount - name: my-scheduler - namespace: kube-system -roleRef: - kind: ClusterRole - name: system:kube-scheduler - apiGroup: rbac.authorization.k8s.io ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - component: scheduler - tier: control-plane - name: my-scheduler - namespace: kube-system -spec: - selector: - matchLabels: - component: scheduler - tier: control-plane - replicas: 1 - template: - metadata: - labels: - component: scheduler - tier: control-plane - version: second - spec: - serviceAccountName: my-scheduler - containers: - - command: - - /usr/local/bin/kube-scheduler - - --address=0.0.0.0 - - --leader-elect=false - - --scheduler-name=my-scheduler - image: gcr.io/my-gcp-project/my-kube-scheduler:1.0 - livenessProbe: - httpGet: - path: /healthz - port: 10251 - initialDelaySeconds: 15 - name: kube-second-scheduler - readinessProbe: - httpGet: - path: /healthz - port: 10251 - resources: - requests: - cpu: '0.1' - securityContext: - privileged: false - volumeMounts: [] - hostNetwork: false - hostPID: false - volumes: [] +apiVersion: v1 +kind: ServiceAccount +metadata: + name: my-scheduler + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: my-scheduler-as-kube-scheduler +subjects: +- kind: ServiceAccount + name: my-scheduler + namespace: kube-system +roleRef: + kind: ClusterRole + name: system:kube-scheduler + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + component: scheduler + tier: control-plane + name: my-scheduler + namespace: kube-system +spec: + selector: + matchLabels: + component: scheduler + tier: control-plane + replicas: 1 + template: + metadata: + labels: + component: scheduler + tier: control-plane + version: second + spec: + serviceAccountName: my-scheduler + containers: + - command: + - /usr/local/bin/kube-scheduler + - --address=0.0.0.0 + - --leader-elect=false + - --scheduler-name=my-scheduler + image: gcr.io/my-gcp-project/my-kube-scheduler:1.0 + livenessProbe: + httpGet: + path: /healthz + port: 10251 + initialDelaySeconds: 15 + name: kube-second-scheduler + readinessProbe: + httpGet: + path: /healthz + port: 10251 + resources: + requests: + cpu: '0.1' + securityContext: + privileged: false + volumeMounts: [] + hostNetwork: false + hostPID: false + volumes: [] diff --git a/content/zh/examples/application/job/rabbitmq/Dockerfile b/content/zh/examples/application/job/rabbitmq/Dockerfile index cbd36bb620..50faab23f4 100644 --- a/content/zh/examples/application/job/rabbitmq/Dockerfile +++ b/content/zh/examples/application/job/rabbitmq/Dockerfile @@ -1,5 +1,5 @@ # Specify BROKER_URL and QUEUE when running -FROM ubuntu:14.04 +FROM ubuntu:18.04 RUN apt-get update && \ apt-get install -y curl ca-certificates amqp-tools python \ diff --git a/content/zh/examples/application/job/rabbitmq/worker.py b/content/zh/examples/application/job/rabbitmq/worker.py index a20884515d..88a7fcf96d 100644 --- a/content/zh/examples/application/job/rabbitmq/worker.py +++ b/content/zh/examples/application/job/rabbitmq/worker.py @@ -3,5 +3,5 @@ # Just prints standard out and sleeps for 10 seconds. import sys import time -print("Processing " + sys.stdin.lines()) +print("Processing " + sys.stdin.readlines()[0]) time.sleep(10) diff --git a/content/zh/examples/application/job/redis/rediswq.py b/content/zh/examples/application/job/redis/rediswq.py index ceda8bd1e3..2b8e81ceab 100644 --- a/content/zh/examples/application/job/redis/rediswq.py +++ b/content/zh/examples/application/job/redis/rediswq.py @@ -111,7 +111,7 @@ class RedisWQ(object): # If we crash here, then the GC code will try to move the value, but it will # not be here, which is fine. So this does not need to be a transaction. itemkey = self._itemkey(value) - self._db.delete(self._lease_key_prefix + itemkey, self._session) + self._db.delete(self._lease_key_prefix + itemkey) # TODO: add functions to clean up all keys associated with "name" when # processing is complete. diff --git a/content/zh/examples/application/job/redis/worker.py b/content/zh/examples/application/job/redis/worker.py index 46cefcfef8..b8abbee917 100644 --- a/content/zh/examples/application/job/redis/worker.py +++ b/content/zh/examples/application/job/redis/worker.py @@ -12,9 +12,9 @@ q = rediswq.RedisWQ(name="job2", host="redis") print("Worker with sessionID: " + q.sessionID()) print("Initial queue state: empty=" + str(q.empty())) while not q.empty(): - item = q.lease(lease_secs=10, block=True, timeout=2) + item = q.lease(lease_secs=10, block=True, timeout=2) if item is not None: - itemstr = item.decode("utf=8") + itemstr = item.decode("utf-8") print("Working on " + itemstr) time.sleep(10) # Put your actual work here instead of sleep. q.complete(item) diff --git a/content/zh/examples/controllers/daemonset.yaml b/content/zh/examples/controllers/daemonset.yaml index a7e895a9cf..f291b750c1 100644 --- a/content/zh/examples/controllers/daemonset.yaml +++ b/content/zh/examples/controllers/daemonset.yaml @@ -1,44 +1,44 @@ -apiVersion: apps/v1 -kind: DaemonSet -metadata: - name: fluentd-elasticsearch - namespace: kube-system - labels: - k8s-app: fluentd-logging -spec: - selector: - matchLabels: - name: fluentd-elasticsearch - template: - metadata: - labels: - name: fluentd-elasticsearch - spec: - tolerations: - # this toleration is to have the daemonset runnable on master nodes - # remove it if your masters can't run pods - - key: node-role.kubernetes.io/master - effect: NoSchedule - containers: - - name: fluentd-elasticsearch - image: quay.io/fluentd_elasticsearch/fluentd:v2.5.2 - resources: - limits: - memory: 200Mi - requests: - cpu: 100m - memory: 200Mi - volumeMounts: - - name: varlog - mountPath: /var/log - - name: varlibdockercontainers - mountPath: /var/lib/docker/containers - readOnly: true - terminationGracePeriodSeconds: 30 - volumes: - - name: varlog - hostPath: - path: /var/log - - name: varlibdockercontainers - hostPath: - path: /var/lib/docker/containers +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: fluentd-elasticsearch + namespace: kube-system + labels: + k8s-app: fluentd-logging +spec: + selector: + matchLabels: + name: fluentd-elasticsearch + template: + metadata: + labels: + name: fluentd-elasticsearch + spec: + tolerations: + # this toleration is to have the daemonset runnable on master nodes + # remove it if your masters can't run pods + - key: node-role.kubernetes.io/master + effect: NoSchedule + containers: + - name: fluentd-elasticsearch + image: quay.io/fluentd_elasticsearch/fluentd:v2.5.2 + resources: + limits: + memory: 200Mi + requests: + cpu: 100m + memory: 200Mi + volumeMounts: + - name: varlog + mountPath: /var/log + - name: varlibdockercontainers + mountPath: /var/lib/docker/containers + readOnly: true + terminationGracePeriodSeconds: 30 + volumes: + - name: varlog + hostPath: + path: /var/log + - name: varlibdockercontainers + hostPath: + path: /var/lib/docker/containers diff --git a/content/zh/examples/controllers/frontend.yaml b/content/zh/examples/controllers/frontend.yaml index fd7665c7f3..b9f31044ec 100644 --- a/content/zh/examples/controllers/frontend.yaml +++ b/content/zh/examples/controllers/frontend.yaml @@ -1,21 +1,21 @@ -apiVersion: apps/v1 -kind: ReplicaSet -metadata: - name: frontend - labels: - app: guestbook - tier: frontend -spec: - # modify replicas according to your case - replicas: 3 - selector: - matchLabels: - tier: frontend - template: - metadata: - labels: - tier: frontend - spec: - containers: - - name: php-redis - image: gcr.io/google_samples/gb-frontend:v3 +apiVersion: apps/v1 +kind: ReplicaSet +metadata: + name: frontend + labels: + app: guestbook + tier: frontend +spec: + # modify replicas according to your case + replicas: 3 + selector: + matchLabels: + tier: frontend + template: + metadata: + labels: + tier: frontend + spec: + containers: + - name: php-redis + image: gcr.io/google_samples/gb-frontend:v3 diff --git a/content/zh/examples/controllers/nginx-deployment.yaml b/content/zh/examples/controllers/nginx-deployment.yaml index 33e68a941f..685c17aa68 100644 --- a/content/zh/examples/controllers/nginx-deployment.yaml +++ b/content/zh/examples/controllers/nginx-deployment.yaml @@ -1,21 +1,21 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx-deployment - labels: - app: nginx -spec: - replicas: 3 - selector: - matchLabels: - app: nginx - template: - metadata: - labels: - app: nginx - spec: - containers: - - name: nginx - image: nginx:1.14.2 - ports: - - containerPort: 80 +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + labels: + app: nginx +spec: + replicas: 3 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 diff --git a/content/zh/examples/controllers/replication-nginx-1.14.2.yaml b/content/zh/examples/controllers/replication-nginx-1.14.2.yaml index 2da69a152f..b74bc81547 100644 --- a/content/zh/examples/controllers/replication-nginx-1.14.2.yaml +++ b/content/zh/examples/controllers/replication-nginx-1.14.2.yaml @@ -1,16 +1,16 @@ -apiVersion: v1 -kind: ReplicationController -metadata: - name: my-nginx -spec: - replicas: 5 - template: - metadata: - labels: - app: nginx - spec: - containers: - - name: nginx - image: nginx:1.14.2 - ports: - - containerPort: 80 +apiVersion: v1 +kind: ReplicationController +metadata: + name: my-nginx +spec: + replicas: 5 + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 diff --git a/content/zh/examples/controllers/replication-nginx-1.16.1.yaml b/content/zh/examples/controllers/replication-nginx-1.16.1.yaml index 64efa4d1c3..0708cae4b5 100644 --- a/content/zh/examples/controllers/replication-nginx-1.16.1.yaml +++ b/content/zh/examples/controllers/replication-nginx-1.16.1.yaml @@ -1,21 +1,21 @@ -apiVersion: v1 -kind: ReplicationController -metadata: - name: my-nginx-v4 -spec: - replicas: 5 - selector: - app: nginx - deployment: v4 - template: - metadata: - labels: - app: nginx - deployment: v4 - spec: - containers: - - name: nginx - image: nginx:1.16.1 - args: ["nginx", "-T"] - ports: - - containerPort: 80 +apiVersion: v1 +kind: ReplicationController +metadata: + name: my-nginx-v4 +spec: + replicas: 5 + selector: + app: nginx + deployment: v4 + template: + metadata: + labels: + app: nginx + deployment: v4 + spec: + containers: + - name: nginx + image: nginx:1.16.1 + args: ["nginx", "-T"] + ports: + - containerPort: 80 diff --git a/content/zh/examples/debug/fluentd-gcp-configmap.yaml b/content/zh/examples/debug/fluentd-gcp-configmap.yaml index 0235ce551a..4abdbc8b91 100644 --- a/content/zh/examples/debug/fluentd-gcp-configmap.yaml +++ b/content/zh/examples/debug/fluentd-gcp-configmap.yaml @@ -1,379 +1,379 @@ -apiVersion: v1 -kind: ConfigMap -data: - containers.input.conf: |- - # This configuration file for Fluentd is used - # to watch changes to Docker log files that live in the - # directory /var/lib/docker/containers/ and are symbolically - # linked to from the /var/log/containers directory using names that capture the - # pod name and container name. These logs are then submitted to - # Google Cloud Logging which assumes the installation of the cloud-logging plug-in. - # - # Example - # ======= - # A line in the Docker log file might look like this JSON: - # - # {"log":"2014/09/25 21:15:03 Got request with path wombat\\n", - # "stream":"stderr", - # "time":"2014-09-25T21:15:03.499185026Z"} - # - # The record reformer is used to write the tag to focus on the pod name - # and the Kubernetes container name. For example a Docker container's logs - # might be in the directory: - # /var/lib/docker/containers/997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b - # and in the file: - # 997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b-json.log - # where 997599971ee6... is the Docker ID of the running container. - # The Kubernetes kubelet makes a symbolic link to this file on the host machine - # in the /var/log/containers directory which includes the pod name and the Kubernetes - # container name: - # synthetic-logger-0.25lps-pod_default-synth-lgr-997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b.log - # -> - # /var/lib/docker/containers/997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b/997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b-json.log - # The /var/log directory on the host is mapped to the /var/log directory in the container - # running this instance of Fluentd and we end up collecting the file: - # /var/log/containers/synthetic-logger-0.25lps-pod_default-synth-lgr-997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b.log - # This results in the tag: - # var.log.containers.synthetic-logger-0.25lps-pod_default-synth-lgr-997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b.log - # The record reformer is used is discard the var.log.containers prefix and - # the Docker container ID suffix and "kubernetes." is pre-pended giving the tag: - # kubernetes.synthetic-logger-0.25lps-pod_default-synth-lgr - # Tag is then parsed by google_cloud plugin and translated to the metadata, - # visible in the log viewer - - # Example: - # {"log":"[info:2016-02-16T16:04:05.930-08:00] Some log text here\n","stream":"stdout","time":"2016-02-17T00:04:05.931087621Z"} - - type tail - format json - time_key time - path /var/log/containers/*.log - pos_file /var/log/gcp-containers.log.pos - time_format %Y-%m-%dT%H:%M:%S.%N%Z - tag reform.* - read_from_head true - - - - type parser - format /^(?\w)(? - - - type record_reformer - enable_ruby true - tag raw.kubernetes.${tag_suffix[4].split('-')[0..-2].join('-')} - - - # Detect exceptions in the log output and forward them as one log entry. - - @type copy - - - @type prometheus - - - type counter - name logging_line_count - desc Total number of lines generated by application containers - - tag ${tag} - - - - - @type detect_exceptions - - remove_tag_prefix raw - message log - stream stream - multiline_flush_interval 5 - max_bytes 500000 - max_lines 1000 - - - system.input.conf: |- - # Example: - # Dec 21 23:17:22 gke-foo-1-1-4b5cbd14-node-4eoj startupscript: Finished running startup script /var/run/google.startup.script - - type tail - format syslog - path /var/log/startupscript.log - pos_file /var/log/gcp-startupscript.log.pos - tag startupscript - - - # Examples: - # time="2016-02-04T06:51:03.053580605Z" level=info msg="GET /containers/json" - # time="2016-02-04T07:53:57.505612354Z" level=error msg="HTTP Error" err="No such image: -f" statusCode=404 - - type tail - format /^time="(?