Search code examples
wordpresskubernetesazure-aksazure-app-service-plans

i want to change my wordpress pod domain name


I hope you all are doing great today ,

here is my situation :

i have 2 wordpress websites (identical )

--1st one is an App Service wordpress in azure with a domain name eg:https://wordpress.azurewebsites.net

--the 2nd one is in aks cluster as a pod with a load balancer that expose it to the internet with a public ip

what i want to do :

i want to take the domain name from the app service and give it to the aks pod

what did i do :

i changed from the dashboard the domain name and changed the load balancer public ip adress and it didn't work now i can't access the dashboard from the load balancer ip adress either

im new in kubernetes i hope someone can guide me to the right direction on how to do it


Solution

  • Seems like you are missing an ingress controller. You could for example install ingress-nginx and expose the ingress with this service config:

    apiVersion: v1
    kind: Service
    metadata:
      name: ingress-nginx-controller
      namespace: ingress-nginx
    spec:
      type: LoadBalancer
      loadBalancerIP: 53.1.1.1
      ports:
      - name: https
        port: 443
        protocol: TCP
        targetPort: https
        appProtocol: https
      selector:
        app.kubernetes.io/name: ingress-nginx
        app.kubernetes.io/instance: ingress-nginx
        app.kubernetes.io/component: controller
    

    You can now create a service for your app:

    apiVersion: v1
    kind: Service
    metadata:
      name: app_service
      namespace: app
    spec:
      type: ClusterIP
      ports:
        - name: service
          port: 80
      selector:
        app: yoour_app
    

    Then you can expose yoour app with an ingress resource:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: app_ingress
      namespace: app
      annotations:
        kubernetes.io/ingress.class: "nginx"
    spec:
      tls:
        - hosts:
          - wordpress.azurewebsites.net
      rules:
        - host: wordpress.azurewebsites.net
          http:
            paths:
              - path: /
                pathType: Prefix
                backend:
                  service:
                    name: app_service
                    port:
                      number: 80