When you would to install K8s deployment or any other K8s images which pulls dependent images from public Internet. Your Kubernetes cluster running on air-gapped environment can’t download any image from public repository (dockerhub, docker.io, gcr etc). You need to pull it first on bootstrap VM where public internet connectivity is there, then tag it and push it to your local image Harbor. Your K8s cluster will pick images from the local Harbor only. Whenever you have tom install any K8s deployable, you need to manually change deployment manifest and replace image path from public to local repo harbor/jFrog etc.
# Pull from public image registry
docker pull metallb/speaker:v0.9.3
# Tag it with your Harbor host
docker tag metallb/speaker:v0.9.3 $HARBOR_HOST/library/metallb/speaker:v0.9.3
#Push to local image registry harbor/jFrog
docker push $HARBOR_HOST/library/metallb/speaker:v0.9.3
#Change image name in your K8s deployment manifest. You are all set!
$ vi metallb-manifest.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: dotnetcore-app-deployment
namespace: default
spec:
securityContext:
runAsUser: 0
selector:
matchLabels:
app: dotnetcore-demo-app
replicas: 3 # tells deployment to run N pods matching the template
template: # create pods using pod definition in this template
metadata:
labels:
app: dotnetcore-demo-app
spec:
containers:
- name: dotnetcore-demo-app
image: harbor.vmwaredc.com/library/dotnet-aspnet-sample
ports:
- containerPort: 9080
name: server
$ kubectl apply -f metallb-manifest.yml
Note: Helm package installable really won’t work on air gapped env, because it tries to pull images from public Internet. You need to refer manifesy yml files only, becuase you haver to chnage the image registry server path before running it on K8s cluster.