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

Need Guidance: Troubleshooting "opt/logs.txt not found" error using "Sidecar Containers" example Deployment #45753

Closed
ranjeet7219 opened this issue Apr 2, 2024 · 9 comments
Labels
kind/support Categorizes issue or PR as a support question. language/en Issues or PRs related to English language needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@ranjeet7219
Copy link

ranjeet7219 commented Apr 2, 2024

when using below config

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
  labels:
    app: myapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
        - name: myapp
          image: alpine:latest
          command: ['sh', '-c', 'while true; do echo "logging" >> /opt/logs.txt; sleep 1; done']
          volumeMounts:
            - name: data
              mountPath: /opt
      initContainers:
        - name: logshipper
          image: alpine:latest
          restartPolicy: Always
          command: ['sh', '-c', 'tail -F /opt/logs.txt']
          volumeMounts:
            - name: data
              mountPath: /opt
      volumes:
        - name: data
          emptyDir: {}

it gives error that opt/logs.txt file does not exist

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Apr 2, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

SIG Docs takes a lead on issue triage for this website, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@dipesh-rawat
Copy link
Member

Page mentioned in issue (based on the issue title): https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers
/language en

@k8s-ci-robot k8s-ci-robot added the language/en Issues or PRs related to English language label Apr 2, 2024
@dipesh-rawat
Copy link
Member

/retitle Need Guidance: Troubleshooting "opt/logs.txt not found" error using "Sidecar Containers" example Deployment

@k8s-ci-robot k8s-ci-robot changed the title Sidecar Containers Need Guidance: Troubleshooting "opt/logs.txt not found" error using "Sidecar Containers" example Deployment Apr 2, 2024
@dipesh-rawat
Copy link
Member

Looks like a support request in its current form.
/kind support

@k8s-ci-robot k8s-ci-robot added the kind/support Categorizes issue or PR as a support question. label Apr 2, 2024
@stmcginnis
Copy link
Contributor

Also needs a lot more detail. What version of Kubernetes are you running? Where are you observing this error? Are there any other log messages?

When the containers first start there will be a brief window where the file does not exist. But it should be created as soon as the main container is started. So you may see something like this if you are looking at the logshipper container's logs:

tail: can't open '/opt/logs.txt': No such file or directory
logging
tail: /opt/logs.txt has appeared; following end of new file
logging
logging
logging
logging

@sftim
Copy link
Contributor

sftim commented Apr 2, 2024

Aside, though: maybe the :latest image tag isn't the best choice on our part.

@ranjeet7219
Copy link
Author

container app does not start only it waits for init container to complete first but which is not possible

@divya-mohan0209
Copy link
Contributor

Hey @ranjeet7219! Thank you for reaching out and seeking assistance. We appreciate your query, but the GitHub issue tracker may not be the most suitable platform for obtaining advice on Kubernetes. We recommend exploring alternative resources such as the Kubernetes Slack community (http://slack.k8s.io/) or the Discuss Kubernetes forum (https://discuss.kubernetes.io/) for the support you need.
/close

@k8s-ci-robot
Copy link
Contributor

@divya-mohan0209: Closing this issue.

In response to this:

Hey @ranjeet7219! Thank you for reaching out and seeking assistance. We appreciate your query, but the GitHub issue tracker may not be the most suitable platform for obtaining advice on Kubernetes. We recommend exploring alternative resources such as the Kubernetes Slack community (http://slack.k8s.io/) or the Discuss Kubernetes forum (https://discuss.kubernetes.io/) for the support you need.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question. language/en Issues or PRs related to English language needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

6 participants