عجفت الغور

kubernetes (k8s)

Tags: computers, distributed systems

Tracing

  • Need

    securityContext: capabilities: add:

    • SYS_PTRACE

    added to the pod to allow for strace and ptrace to work. Example:

    
    apiVersion: v1
    kind: Pod
    metadata:
      name: <POD_NAME>
      namespace: default
    spec:
      containers:
        image: <IMAGE>
        imagePullPolicy: IfNotPresent
        name: web
        command: ["/bin/sleep"]
        args: ["1000000"]
        securityContext:
          capabilities:
            add:
    ​        - SYS_PTRACE
        ports:
    ​    - containerPort: 80
          name: http
          protocol: TCP
        resources:
          limits:
            cpu: "40"
            memory: 100G
          requests:
            cpu: "38"
            memory: 100G
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
    ​    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
          name: kube-api-access-qtpks
          readOnly: true
    

Kubernetes get all logs for pods of a specific type

kubectl get pods -o wide |  rg '<POD_NAME> ' | rg '0/1' --fixed-strings | rg '<POD_NAME>.{20}\s' -o | cut -d ' ' -f 1 | xargs -L 1 kubectl logs --tail 10

Kube 1.24 and 1.25 major changes

Things to worry about

  • volumesnapshot?

Cloud Native postgres

Kubeshark (API traffic analyzer for kube)

BSD Jails vs cgroups and namespaces

  • BSD jails, solaris zones, and linux cgroups + namespaces all do the same thing
  • Containers are built on top of cgroups and namespaces