k3s image pull from private registries k3s image pull from private registries kubernetes kubernetes

k3s image pull from private registries


... this is so stupid, have no idea why a domain name and port needs to be specified as the "name" of your referred registry, but anyway this solved my issue (for reference):

$cat /etc/rancher/k3s/registries.yamlmirrors:  "<host IP>:10000":    endpoint:      - "http://<host IP>:10000"

and restarting k3s:

systemctl restart k3s

Then in your deployment, referring to that in your image path as:

apiVersion: apps/v1kind: Deploymentmetadata:  name: tcpserialpassthroughspec:  selector:    matchLabels:      app: tcpserialpassthrough  replicas: 1  template:    metadata:      labels:        app: tcpserialpassthrough    spec:      containers:      - name: tcpserialpassthrough        image: <host IP>:10000/tcpserialpassthrough:vers1.3-arm        resources:          limits:            memory: "128Mi"            cpu: "500m"        ports:        - containerPort: 8001          hostPort: 8001          protocol: TCP        command: ["dotnet", "/app/TcpConnector.dll"]      imagePullSecrets:      - name: mydockercredentials

referring to registry's basic auth details saved as a secret:

$ kubectl create secret docker-registry mydockercredentials --docker-server host IP:10000 --docker-username username --docker-password password

You'll be able to verify the pull process via

$ kubectl get events -w