Skip to main content

What should I do if the dependent image cannot be pulled, or the inner environment cannot access ghcr.io?

Answer: here are three solutions to solve this problem

  • Solution 1: In the network that can access ghcr.io, transfer the image in the command kubevpn version to your own private image registry, and then add option --image to specify the image when starting the command. Example:
➜  ~ kubevpn version
KubeVPN: CLI
Version: v2.11.5
Daemon: v2.11.5
Image: ghcr.io/kubenetworks/kubevpn:v2.11.5
Branch: master
Git commit: ac918b5
Built time: 2024-09-03 20:31:08
Built OS/Arch: darwin/arm64
Built Go version: go1.22.6

Image is ghcr.io/kubenetworks/kubevpn:v2.11.5, transfer this image to private docker registry

docker pull ghcr.io/kubenetworks/kubevpn:v2.11.5
docker tag ghcr.io/kubenetworks/kubevpn:v2.11.5 [docker registry]/[namespace]/[repo]:[tag]
docker push [docker registry]/[namespace]/[repo]:[tag]

Then you can use this image, as follows:

➜  ~ kubevpn connect --image [docker registry]/[namespace]/[repo]:[tag]
Starting connect
Detected cluster CIDRs: 172.29.0.0/16, 172.21.0.0/16
...
  • Solution 2: Use options --transfer-image, enable this flag will transfer image from default image to --image specified address automatically. Example
➜  ~ kubevpn connect --transfer-image --image registry.example.org/kubevpn/kubevpn:latest
Starting connect
Detected cluster CIDRs: 172.29.0.0/16, 172.21.0.0/16 (cached)
Using traffic manager in namespace "default"
Forwarded ports (TCP/UDP/xDS)
Allocated TUN IP 198.18.0.100
Created TUN device "utun4"
Configured DNS
Now you can access resources in the kubernetes cluster !
➜ ~
  • Solution 3: Use the kubevpn image copy command to copy the image to your private registry:
kubevpn image copy ghcr.io/kubenetworks/kubevpn:latest registry.example.org/kubevpn/kubevpn:latest

Then use --image to specify the private registry image:

kubevpn connect --image registry.example.org/kubevpn/kubevpn:latest

If your private registry requires authentication, you can create a Kubernetes secret and reference it:

kubevpn connect --image registry.example.org/kubevpn/kubevpn:latest --image-pull-secret-name my-registry-secret