Score:0

Microk8s Bind to Port 80 with Non-Root User

us flag

I seem to be having an issue on microk8s that when I run a pod / container as non-root in Microk8s it cannot bind to port 80 even though I had the NET_BIND_SERVICE capability enabled. It works however if I run the container as root. I can use the NET_BIND_SERVICE capability fine on Docker so I am unsure why it is an issue on Microk8s. Could anyone help me resolve this please?

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    com.monitoring.cadvisor: "true"
    kompose.cmd: kompose convert -v -f ../../Docker Compose/gotify.yml --out ./gotify.yml
    kompose.version: 1.26.1 (a9d05d509)
  creationTimestamp: null
  labels:
    io.kompose.service: gotify-deployment
    io.kompose.network/gotify: "true"
  name: gotify
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: gotify-deployment
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        com.monitoring.cadvisor: "true"
        kompose.cmd: kompose convert -v -f ../../Docker Compose/gotify.yml --out ./gotify.yml
        kompose.version: 1.26.1 (a9d05d509)
      creationTimestamp: null
      labels:
        io.kompose.network/gotify: "true"
        io.kompose.service: gotify-deployment
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: gotify
                    operator: In
                    values:
                      - "true"
#      securityContext:
#        runAsNonRoot: true
#        runAsUser: 1002
#        runAsGroup: 1002   
      containers:
        - env:
            - name: GOTIFY_DEFAULTUSER_PASS
              value: custom
            - name: TZ
              value: Europe/London
          image: gotify/server:2.1.7
          imagePullPolicy: IfNotPresent
          name: gotify
          resources:
            limits:
              cpu: "0.25"
              memory: "256Mi"
          securityContext:
            capabilities:
              drop:
                - ALL
              add:
                - NET_BIND_SERVICE
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.