Skip to content

Script freezes when deployed in Kubernetes (k3s) #208

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

Open
Tchoupinax opened this issue Dec 18, 2024 · 0 comments
Open

Script freezes when deployed in Kubernetes (k3s) #208

Tchoupinax opened this issue Dec 18, 2024 · 0 comments

Comments

@Tchoupinax
Copy link

Tchoupinax commented Dec 18, 2024

Hello!

I met a weird behavior in my k3s cluster that I tried to investigate but I miss knowledge about Python.
I had no logs even with correct configuration and I did not understand so I rebuild Docker image from my computer and I added logs everywhere on the path to understand what is done.

I came until this line where a new Pool is declared and the script freezes here. No error, no logs, no ends. Nothing.

def __init__(self):
    print("Before Pool") # Displayed
    self.pool = Pool()
    print("After Pool") # Never displayed
    self.last_call_timestamp = 0 
  • I rebuilt Docker image from main
  • It works locally and locally in Docker (same image that I deploy in Kubernetes)
  • I tested several nodes in my cluster, same behavior on three.

I tried to change security parameter, no one has an impact.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mktxp-exporter
spec:
  selector:
    matchLabels:
      app: mktxp-exporter
  template:
    metadata:
      labels:
        app: mktxp-exporter
    spec:
      hostPID: true # <======================== HERE
      securityContext:
        runAsUser: 1000 # <======================== HERE
        runAsGroup: 3000 # <======================== HERE
      containers:
      - name: mktxp-exporter
        image: image
        args:
          - --cfg-dir
          - /mktxp_config/
          - export
        resources:
          limits:
            memory: "512Mi"
            cpu: "500m"
        volumeMounts:
          - name: mktxp-credentials
            mountPath: /mktxp_config
          - mountPath: /dev/shm # <======================== HERE
            name: dshm # <======================== HERE
        ports:
        - containerPort: 49090
      volumes:
        - name: mktxp-credentials
          secret:
            secretName: mktxp-credentials
        - name: dshm # <======================== HERE
          emptyDir: # <======================== HERE
            medium: Memory # <======================== HERE

It's the first time I see this kind of freeze and I do not know Python.

My ideas:

  • Pool lib requires privilege in the cluster?
  • There is another issue I do not understand because of my lack of knowledge?

I do not exactly if it comes from code or from environment, because no one has complained about it before so probably it comes from my environment. That's said, the block on Pool means something and I need help on this.

I hope the description is enough clear for anyone!

Thanks for your work on this project!

Information:

  • Latest commit from main
  • k3s (1.30.x)
  • Python 3.13.1
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

No branches or pull requests

1 participant