I’m following this tutorial: How To Deploy a Scalable and Secure Django Application with Kubernetes | DigitalOcean
I’m stuck in Step 7 - ## Allowing External Access using a Service now.
I configured my service file, and I can view my port and External IP address
(projectenv) D:\Interscale\Project\CustomerPortals\Customer_Portals\backend\myproject\yaml>kubectl get svc app NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE app NodePort <Cluster-IP> <none> 8000:<My Port>/TCP 17s (projectenv) D:\Interscale\Project\CustomerPortals\Customer_Portals\backend\myproject\yaml>kubectl get node -o wide NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME client-portal-nodepool-qjfch Ready <none> 3d5h v1.25.4 <InternalIP> <My External IP> Debian GNU/Linux 11 (bullseye) 5.18.0-0.deb11.4-amd64 containerd://1.4.13
But when I’m trying to access my site, I got this error: # This site can’t be reached
<My External IP address> took too long to respond.
This is the format I input in site:
http://<External IP address>:<Port>/admin/
And I runned my django project locally at first, it works fine.
I think the problem is because I’m using the Private Docker Registry. I checked the tutorial in Kubernetes setting the credentials. But I think the configuration process is not so clear. This is the tutorial link: Pull an Image from a Private Registry | Kubernetes
I don’t know what should I put for <your-registry-server>.
kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
and I don’t know how to import the ‘regcred’ when I have created it.
So I just modified my Deploy.yaml file like this:
apiVersion: apps/v1 kind: Deployment metadata: name: portals-app labels: app: app spec: replicas: 2 selector: matchLabels: app: app template: metadata: labels: app: app spec: containers: - image: xichen9718/portals_docker_repository:latest name: app envFrom: - secretRef: name: app-secret - configMapRef: name: app-config ports: - containerPort: 8000 name: gunicorn imagePullSecrets: - name: regcred
Can anyone help me with this problem please
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
What I could suggest is to use a Load Balancer as a service rather than NodePort.
For more information you can take a look at the following documentation:
Hope that this helps!