Unable to access ingress gateway using custom domain

2/6/2020

i am new to istio. i have installed kubernetes on ionos online server. i am able to deploy my sample application successfully and am able to browse it by providing INGRESS_HOST:INGRESS_PORT in browser.

please click on following linke to see detail of my ingress loadbalancer load balancer

i am not able to browse using my domain name like example.com

Do i have to install another loadbalancer which will redirect example.com to that particular INGRESS_HOST:INGRESS_PORT ( as example.com is being access on port 80 and INGRESS_PORT is different )

any help will be appreciated. thanks

# project_service.yaml
apiVersion: v1
kind: Service
metadata:
  name: php
  namespace: default
  labels:
    tier: backend
spec:
  selector:
    app: php
    tier: backend
  ports:
    - protocol: TCP
      port: 9000
# project_deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: php
  namespace: default
  labels:
    tier: backend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: php
      tier: backend
  template:
    metadata:
      labels:
        app: php
        tier: backend
    spec:
      volumes:
      - name: dir
        hostPath:
          path: /code
      containers:
      - name: php
        image: some_image
        imagePullPolicy: Never
        volumeMounts:
        - name: dir
          mountPath: /code
        env:
        - name: APP_NAME
          value: "Test"
        #- and so on ...       
      initContainers:
      - name: install
        image: busybox
        volumeMounts:
        - name: dir
          mountPath: /code
        command:
        - cp
        - "-r"
        - "/var/www/."
        - "/code/app"
# nginx_configMap

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-config
  namespace: default  
  labels:
    tier: backend
data:
  config : |
    server {
      index index.php index.html;
      error_log  /var/log/nginx/error.log;
      access_log /var/log/nginx/access.log;
      
      root /code/app;

      location / {
          try_files $uri $uri/ /index.php?$query_string;
      }
      
      location ~ .php$ {
          try_files $uri =404;
          fastcgi_split_path_info ^(.+.php)(/.+)$;
          fastcgi_pass php:9000;
          fastcgi_index index.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
      }
    }
# nginx_service
kind: Service
apiVersion: v1
metadata:
  name: nginx
  namespace: default    
  labels:
    tier: backend
    app: nginx
spec:
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
      #nodePort: 32380
  selector:
    tier: backend
    app: nginx
  type: LoadBalancer
# nginx_Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  namespace: default    
  labels:
    tier: backend
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
      tier: backend
  template:
    metadata:
      labels:
        app: nginx
        tier: backend
    spec:
      volumes:
      - name: dir
        hostPath:
          path: /code
      - name: config
        configMap:
          name: nginx-config
          items:
          - key: config
            path: site.conf
      containers:
      - name: nginx
        image: nginx
        volumeMounts:
        - name: dir
          mountPath: /code
        - name: config
          mountPath: /etc/nginx/conf.d
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
kind: Service
apiVersion: v1
metadata:
  name: nginx
  namespace: default    
  labels:
    tier: backend
    app: nginx
spec:
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
      #nodePort: 32380
  selector:
    tier: backend
    app: nginx
  type: LoadBalancer

this way of deployment was described in following video https://www.youtube.com/watch?v=8e0vtNO-T_I

-- Shahid Mushtaq
istio
kubernetes

0 Answers