mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 12:11:43 +00:00
Update logging getting started guides to reflect namespace change
This commit is contained in:
@@ -2,11 +2,12 @@
|
||||
|
||||
A Kubernetes cluster will typically be humming along running many system and application pods. How does the system administrator collect, manage and query the logs of the system pods? How does a user query the logs of their application which is composed of many pods which may be restarted or automatically generated by the Kubernetes system? These questions are addressed by the Kubernetes **cluster level logging** services.
|
||||
|
||||
Cluster level logging for Kubernetes allows us to collect logs which persist beyond the lifetime of the pod’s container images or the lifetime of the pod or even cluster. In this article we assume that a Kubernetes cluster has been created with cluster level logging support for sending logs to Google Cloud Logging. After a cluster has been created you will have a collection of system pods running that support monitoring, logging and DNS resolution for names of Kubernetes services:
|
||||
Cluster level logging for Kubernetes allows us to collect logs which persist beyond the lifetime of the pod’s container images or the lifetime of the pod or even cluster. In this article we assume that a Kubernetes cluster has been created with cluster level logging support for sending logs to Google Cloud Logging. After a cluster has been created you will have a collection of system pods running in the `kube-system` namespace that support monitoring,
|
||||
logging and DNS resolution for names of Kubernetes services:
|
||||
|
||||
```
|
||||
$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
$ kubectl get pods --namespace=kube-system
|
||||
NAME READY REASON RESTARTS AGE
|
||||
fluentd-cloud-logging-kubernetes-minion-0f64 1/1 Running 0 32m
|
||||
fluentd-cloud-logging-kubernetes-minion-27gf 1/1 Running 0 32m
|
||||
fluentd-cloud-logging-kubernetes-minion-pk22 1/1 Running 0 31m
|
||||
@@ -28,6 +29,7 @@ To help explain how cluster level logging works let’s start off with a synthet
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: counter
|
||||
namespace: default
|
||||
spec:
|
||||
containers:
|
||||
- name: count
|
||||
@@ -35,7 +37,8 @@ To help explain how cluster level logging works let’s start off with a synthet
|
||||
args: [bash, -c,
|
||||
'for ((i = 0; ; i++)); do echo "$i: $(date)"; sleep 1; done']
|
||||
```
|
||||
This pod specification has one container which runs a bash script when the container is born. This script simply writes out the value of a counter and the date once per second and runs indefinitely. Let’s create the pod.
|
||||
This pod specification has one container which runs a bash script when the container is born. This script simply writes out the value of a counter and the date once per second and runs indefinitely. Let’s create the pod in the default
|
||||
namespace.
|
||||
|
||||
```
|
||||
$ kubectl create -f counter-pod.yaml
|
||||
@@ -47,12 +50,6 @@ We can observe the running pod:
|
||||
$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
counter 1/1 Running 0 5m
|
||||
fluentd-cloud-logging-kubernetes-minion-0f64 1/1 Running 0 55m
|
||||
fluentd-cloud-logging-kubernetes-minion-27gf 1/1 Running 0 55m
|
||||
fluentd-cloud-logging-kubernetes-minion-pk22 1/1 Running 0 55m
|
||||
fluentd-cloud-logging-kubernetes-minion-20ej 1/1 Running 0 55m
|
||||
kube-dns-v3-pk22 3/3 Running 0 55m
|
||||
monitoring-heapster-v1-20ej 0/1 Running 9 56m
|
||||
```
|
||||
This step may take a few minutes to download the ubuntu:14.04 image during which the pod status will be shown as `Pending`.
|
||||
|
||||
@@ -124,6 +121,7 @@ apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: fluentd-cloud-logging
|
||||
namespace: kube-system
|
||||
spec:
|
||||
containers:
|
||||
- name: fluentd-cloud-logging
|
||||
|
Reference in New Issue
Block a user