For testing purpose, I want to keep things simple and run a Python Docker image on Kubernetes. So I used a Pod as smallest unit, based on the official template from the Kubernetes docs:
apiVersion: v1 kind: Pod metadata: name: my-app labels: app: my-app spec: containers: - name: my-app image: my-local.registry/my-app-image:0.1 imagePullPolicy: IfNotPresent
But this Pod doesn't start and create a lot of errors like this:
Warning FailedCreatePodSandBox 2m41s kubelet, k8sw01 Failed create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "d2e6c36361b19e39b908422f17ba1a7d2cb8dfd53fcd4822f409848f99ec7b50" network for pod "my-app": NetworkPlugin cni failed to set up pod "my-app_my-app" network: connection is unauthorized
But when running the same container as a deployment, it works fine:
apiVersion: apps/v1 kind: Deployment metadata: name: my-app labels: app: my-app spec: replicas: 1 selector: matchLabels: app: my-app template: metadata: labels: app: my-app spec: containers: - name: my-app image: my-local.registry/my-app-image:0.1 imagePullPolicy: IfNotPresent
I compared the generated pod from the Deployment with my standalone Pod and couldn't find noticeable, not-generated attributes which I miss. The registry is a self hosted instance of the Docker registry helm chart without authentication.