Skip to content

Commit 67012e7

Browse files
authored
Control Plane Logs Collection for OCNE and Standalone Kubernetes Clusters (#56)
* Control Plane Logs Collection for OCNE and Standalone Kubernetes Clusters
1 parent a802a45 commit 67012e7

File tree

8 files changed

+137
-5
lines changed

8 files changed

+137
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## 2023-11-07
4+
### Added
5+
- Control Plane Logs Collection for OCNE and Standalone Kubernetes Clusters.
6+
- Support for launching Fluentd containers in privileged mode (default false).
7+
- Added FAQ for triaging log collection setup issues in OCNE and Standalone Kubernetes Clusters.
8+
39
## 2023-10-31
410
### Changed
511
- Ruby upgrade from 2.7.8 to 3.1.2 for OL8-Slim Fluentd container image. It also includes Fluentd (1.15.3 to 1.16.2) and other dependency gem upgrades.

charts/logan/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: v2
55
name: oci-onm-logan
66
description: Charts for sending Kubernetes platform logs, compute logs, and Kubernetes Objects information to OCI Logging Analytics.
77
type: application
8-
version: 3.1.0
8+
version: 3.1.1
99
appVersion: "3.0.0"
1010

1111
dependencies:

charts/logan/templates/fluentd-daemonset.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ spec:
3333
tolerations:
3434
- key: node-role.kubernetes.io/master
3535
effect: NoSchedule
36+
- key: node-role.kubernetes.io/control-plane
37+
effect: NoSchedule
3638
{{- if $imagePullSecrets }}
3739
imagePullSecrets:
3840
- name: {{ .Values.image.imagePullSecrets }}
@@ -41,6 +43,10 @@ spec:
4143
- name: {{ $resourceNamePrefix }}-fluentd
4244
image: {{ .Values.image.url }}
4345
imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
46+
{{- if .Values.privileged }}
47+
securityContext:
48+
privileged: {{ .Values.privileged }}
49+
{{- end}}
4450
env:
4551
- name: FLUENTD_CONF
4652
value: {{ .Values.fluentd.path }}/{{ .Values.fluentd.file }}

charts/logan/templates/fluentd-deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ spec:
3838
- name: {{ $resourceNamePrefix }}-fluentd
3939
image: {{ .Values.image.url }}
4040
imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
41+
{{- if .Values.privileged }}
42+
securityContext:
43+
privileged: {{ .Values.privileged }}
44+
{{- end}}
4145
env:
4246
- name: FLUENTD_CONF
4347
value: {{ .Values.fluentd.path }}/{{ .Values.fluentd.file }}

charts/logan/templates/logs-configmap.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ data:
7373
encoding {{ $.Values.fluentd.tailPlugin.encoding }}
7474
{{- end }}
7575
<parse>
76-
{{- if eq $runtime "docker" }}
76+
{{- if eq $name "kube-audit" }}
77+
@type none
78+
{{- else if eq $runtime "docker" }}
7779
@type json
7880
{{- else}}
7981
@type cri
@@ -119,7 +121,7 @@ data:
119121
# Concat filter to handle partial logs in CRI/ContainerD
120122
# Docker can also have partial logs but handling is different for different docker versions. Considering Kubernetes/OKE moved to ContainerD/CRI since last 4-5 releases, ignoring docker handling.
121123
# This filter can not be clubbed with concat filter for multiline as both are mutually exclusive.
122-
{{- if eq $runtime "cri" }}
124+
{{- if and (ne $name "kube-audit") (eq $runtime "cri") }}
123125
<filter oci{{- ternary (print "." $currWorker) "" $multiWorkersEnabled }}.oke.{{ $name }}.**>
124126
@type concat
125127
key message

charts/logan/values.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ kubernetesClusterID:
6767
# e.g. production-cluster
6868
kubernetesClusterName:
6969

70+
# -- Kubernetes Security Context privileged flag
71+
# Default: 'false'. This is not a required for OKE clusters.
72+
# In Kubernetes environments where SELinux mode is enforced, set this flag to 'true' to allow fluentd pods to access log files.
73+
privileged: false
74+
7075
# -- Logging Analytics OCID for OKE Cluster
7176
#ociLAEntityID:
7277

@@ -303,6 +308,48 @@ fluentd:
303308
ociLALogSourceName: "Kubernetes Autoscaler Logs"
304309
# The regular expression pattern for the starting line in case of multi-line logs.
305310
multilineStartRegExp: /^\S\d{2}\d{2}\s+[^\:]+:[^\:]+:[^\.]+\.\d{0,3}/
311+
312+
# Config specific to API Server Logs Collection
313+
kube-apiserver:
314+
# The path to the source files.
315+
path: /var/log/containers/kube-apiserver-*.log
316+
# Logging Analytics log source to use for parsing and processing the logs: Kubernetes API Server Logs.
317+
ociLALogSourceName: "Kubernetes API Server Logs"
318+
# The regular expression pattern for the starting line in case of multi-line logs.
319+
multilineStartRegExp: /^\S\d{2}\d{2}\s+[^\:]+:[^\:]+:[^\.]+\.\d{0,3}/
320+
321+
# Config specific to etcd Logs Collection
322+
etcd:
323+
# The path to the source files.
324+
path: /var/log/containers/etcd-*.log
325+
# Logging Analytics log source to use for parsing and processing the logs: Kubernetes etcd Logs.
326+
ociLALogSourceName: "Kubernetes etcd Logs"
327+
328+
# Config specific to kube-controller-manager Logs Collection
329+
kube-controller-manager:
330+
# The path to the source files.
331+
path: /var/log/containers/kube-controller-manager-*.log
332+
# Logging Analytics log source to use for parsing and processing the logs: Kubernetes Controller Manager Logs.
333+
ociLALogSourceName: "Kubernetes Controller Manager Logs"
334+
# The regular expression pattern for the starting line in case of multi-line logs.
335+
multilineStartRegExp: /^\S\d{2}\d{2}\s+[^\:]+:[^\:]+:[^\.]+\.\d{0,3}/
336+
337+
# Config specific to kube-scheduler Logs Collection
338+
kube-scheduler:
339+
# The path to the source files.
340+
path: /var/log/containers/kube-scheduler-*.log
341+
# Logging Analytics log source to use for parsing and processing the logs: Kubernetes Scheduler Logs.
342+
ociLALogSourceName: "Kubernetes Scheduler Logs"
343+
# The regular expression pattern for the starting line in case of multi-line logs.
344+
multilineStartRegExp: /^\S\d{2}\d{2}\s+[^\:]+:[^\:]+:[^\.]+\.\d{0,3}/
345+
346+
# Config specific to Kubernetes Audit Logs Collection
347+
kube-audit:
348+
# The path to the source files.
349+
path: /var/log/kubernetes/audit/audit*
350+
# Logging Analytics log source to use for parsing and processing the logs: Kubernetes Audit Logs.
351+
ociLALogSourceName: "Kubernetes Audit Logs"
352+
306353
# Configuration for Linux System specific logs like CronLogs and SecureLogs
307354
linuxSystem:
308355
# Setting the following properties will override the default/generic configuration and applies to all Kubernetes system logs
@@ -394,6 +441,10 @@ fluentd:
394441
- '"/var/log/containers/csi-oci-node-*.log"'
395442
- '"/var/log/containers/proxymux-client-*.log"'
396443
- '"/var/log/containers/cluster-autoscaler-*.log"'
444+
- '"/var/log/containers/kube-apiserver-*.log"'
445+
- '"/var/log/containers/etcd-*.log"'
446+
- '"/var/log/containers/kube-controller-manager-*.log"'
447+
- '"/var/log/containers/kube-scheduler-*.log"'
397448
# Worker number in case of multi process workers enabled. If not set when multi process workers enabled, then it defaults to 0.
398449
#worker: 1
399450

charts/oci-onm/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type: application
1818
# This is the chart version. This version number should be incremented each time you make changes
1919
# to the chart and its templates, including the app version.
2020
# Versions are expected to follow Semantic Versioning (https://semver.org/)
21-
version: 3.1.0
21+
version: 3.1.1
2222

2323
# This is the version number of the application being deployed. This version number should be
2424
# incremented each time you make changes to the application. Versions are not expected to
@@ -32,7 +32,7 @@ dependencies:
3232
repository: "file://../common"
3333
condition: oci-onm-common.enabled
3434
- name: oci-onm-logan
35-
version: "3.1.0"
35+
version: "3.1.1"
3636
repository: "file://../logan"
3737
condition: oci-onm-logan.enabled
3838
- name: oci-onm-mgmt-agent

docs/FAQ.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,66 @@ oci-onm-logan:
275275
worker: 1
276276
```
277277

278+
### Log Collection for OCNE (Oracle Cloud Native Environment)
279+
280+
#### How to fix _execution expired_ error ?
281+
282+
Log location: `/var/log/oci-logging-analytics.log`
283+
284+
Sample Error :
285+
```
286+
E, [2023-08-07T10:17:13.710854 #18] ERROR -- : oci upload exception : Error while uploading the payload. { 'message': 'execution expired', 'status': 0, 'opc-request-id': 'D733ED0C244340748973D8A035068955', 'response-body': '' }
287+
```
288+
289+
* Check if your OCNE setup configuration has `restrict-service-externalip` value set to `true` for kubernetes module. If yes, update it to false to allow access to Logging Analytics endpoint from containers. Refer [this](https://docs.oracle.com/en/operating-systems/olcne/1.3/orchestration/external-ips.html#8.4-Enabling-Access-to-all-externalIPs) for more details. If the issue is still not resolved,
290+
* Check if your OCNE setup configuration has `selinux` value set to `enforcing` in globals section. If yes, you may need to start the fluentd containers in privileged mode. To achieve the same, set `privileged` to true in override_values.yaml.
291+
292+
```
293+
..
294+
..
295+
oci-onm-logan:
296+
..
297+
..
298+
privileged: true
299+
```
300+
301+
#### How to fix _Permission denied @ dir_s_mkdir - /var/log/oci_la_fluentd_outplugin_ error ?
302+
303+
Log location: Pod logs of Daemonset `oci-onm-logan`
304+
305+
Set `privileged` to true in override_values.yaml to resolve this.
306+
307+
```
308+
..
309+
..
310+
oci-onm-logan:
311+
..
312+
..
313+
privileged: true
314+
```
315+
316+
### Log Collection for Standalone cluster (docker runtime)
317+
318+
#### How to fix the warning _/var/log/containers/..log unreadable_ ?
319+
320+
Log location: Pod logs of Daemonset `oci-onm-logan`
321+
322+
Sample Error:
323+
```
324+
2023-10-10 13:00:16 +0000 [warn]: #0 [in_tail_containerlogs] /var/log/containers/kube-flannel-ds-kl9bb_kube-flannel_kube-flannel-c2a954a05c57f4f68bc3ab348f071812be2405c76bd1631890638eac7c503506.log unreadable. It is excluded and would be examined next time.
325+
```
326+
327+
The default path for docker data (in which the container logs will be written) in a typical standalone cluster is `/var/lib/docker/containers`. You may need to validate the same and update `containerdataHostPath` in override_values.yaml accordingly.
328+
329+
```
330+
..
331+
..
332+
oci-onm-logan:
333+
..
334+
..
335+
volumes:
336+
..
337+
containerdataHostPath: /var/lib/docker/containers
338+
```
339+
340+

0 commit comments

Comments
 (0)