Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use k8s master URL instead of kubernetes.default.svc #186

Merged
merged 1 commit into from
Jan 8, 2022

Conversation

wenchajun
Copy link
Member

Users can customize the service. However, in the case of multiple nodes, the hosts files on each machine are different, so you need to adjust the hosts files.

Please see for more details #184

Signed-off-by: chengdehao [email protected]

@wenchajun
Copy link
Member Author

The user can generate the corresponding FluentBitPod through this configuration
b1878a0b37bd4559dc0ddc599fd9a94
65a7d6c0c9c1fdb95d0503a8edad27b

@wanjunlei wanjunlei self-requested a review January 6, 2022 03:46
@wanjunlei
Copy link
Collaborator

Please update the doc, use k8s master URL instead of kubernetes.default.svc.

@wenchajun wenchajun changed the title Users can use k8s master URL instead of kubernetes.default.svc use k8s master URL instead of kubernetes.default.svc Jan 6, 2022
@benjaminhuo
Copy link
Member

benjaminhuo commented Jan 7, 2022

Just like the code below:
K8s API is defined as Spec.Template.Spec.Volumes and Spec.Template.Spec.Containers[0].VolumeMounts
The field we defined in FB crd should follow the same schema: fb.Spec.Volumes and fb.Spec.VolumeMounts @wenchajun

	if fb.Spec.Volumes !=nil {
		ds.Spec.Template.Spec.Volumes=append(ds.Spec.Template.Spec.Volumes,fb.Spec.Volumes...)
	}
	if fb.Spec.VolumesMount !=nil {
		ds.Spec.Template.Spec.Containers[0].VolumeMounts=append(ds.Spec.Template.Spec.Containers[0].VolumeMounts,fb.Spec.VolumesMount...)
	}

@wenchajun
Copy link
Member Author

Just like the code below: K8s API is defined as Spec.Template.Spec.Volumes and Spec.Template.Spec.Containers[0].VolumeMounts The field we defined in FB crd should follow the same schema: fb.Spec.Volumes and fb.Spec.VolumeMounts @wenchajun

	if fb.Spec.Volumes !=nil {
		ds.Spec.Template.Spec.Volumes=append(ds.Spec.Template.Spec.Volumes,fb.Spec.Volumes...)
	}
	if fb.Spec.VolumesMount !=nil {
		ds.Spec.Template.Spec.Containers[0].VolumeMounts=append(ds.Spec.Template.Spec.Containers[0].VolumeMounts,fb.Spec.VolumesMount...)
	}

But this may increase the burden of users. We may need to create multiple structures.
Our CR currently looks like this:

spec:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
          - matchExpressions:
              - key: node-role.kubernetes.io/edge
                operator: DoesNotExist
  fluentBitConfigName: fluent-bit-config
  image: 'kubesphere/fluent-bit:v1.8.3'
  positionDB:
    emptyDir: {}
  resources:
    limits:
      cpu: 500m
      memory: 200Mi
    requests:
      cpu: 10m
      memory: 25Mi
  tolerations:
    - operator: Exists
  volumes:
    - hostPath:
        path: /etc/hosts
        type: File
      name: hosts
  volumesMount:
    - mountPath: /etc/hosts
      name: hosts
      readOnly: true

@benjaminhuo
Copy link
Member

I mean you define VolumesMount as an array, it should be VolumesMounts just like k8s API does

	// List of volumes that can be mounted by containers belonging to the pod.
	Volumes []corev1.Volume `json:"volumes,omitempty"`
	// Pod volumes to mount into the container's filesystem.
	VolumesMount  []corev1.VolumeMount  `json:"volumesMount,omitempty"`

Signed-off-by: chengdehao <[email protected]>
@florian-asche
Copy link

Just like the code below: K8s API is defined as Spec.Template.Spec.Volumes and Spec.Template.Spec.Containers[0].VolumeMounts The field we defined in FB crd should follow the same schema: fb.Spec.Volumes and fb.Spec.VolumeMounts @wenchajun

	if fb.Spec.Volumes !=nil {
		ds.Spec.Template.Spec.Volumes=append(ds.Spec.Template.Spec.Volumes,fb.Spec.Volumes...)
	}
	if fb.Spec.VolumesMount !=nil {
		ds.Spec.Template.Spec.Containers[0].VolumeMounts=append(ds.Spec.Template.Spec.Containers[0].VolumeMounts,fb.Spec.VolumesMount...)
	}

But this may increase the burden of users. We may need to create multiple structures. Our CR currently looks like this:

spec:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
          - matchExpressions:
              - key: node-role.kubernetes.io/edge
                operator: DoesNotExist
  fluentBitConfigName: fluent-bit-config
  image: 'kubesphere/fluent-bit:v1.8.3'
  positionDB:
    emptyDir: {}
  resources:
    limits:
      cpu: 500m
      memory: 200Mi
    requests:
      cpu: 10m
      memory: 25Mi
  tolerations:
    - operator: Exists
  volumes:
    - hostPath:
        path: /etc/hosts
        type: File
      name: hosts
  volumesMount:
    - mountPath: /etc/hosts
      name: hosts
      readOnly: true

yeah. I want fluent-bit to write the logfiles with the file output module. How can i mount a volume inside my fluent-bit container?

@wenchajun wenchajun deleted the svc branch April 6, 2023 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants