Attempting to configure a 'dummy' endpoint (in the future will be a valid endpoint but the dummy is just a placeholder for now), on the AKS ingress controller. What would be the ideal way to accomplish that? Thanks in advance.
Attempting to configure a 'dummy' endpoint (in the future will be a valid endpoint but the dummy is just a placeholder for now), on the AKS ingress controller. What would be the ideal way to accomplish that? Thanks in advance.
@BeTheCode-5162 , Thank you for your question. You can make use of the NGINX Ingress default backend. The default backend is a service which handles all URL paths and hosts the nginx controller doesn't understand (i.e., all the requests that are not mapped with an Ingress).
Basically a default backend exposes two URLs:
/healthz that returns 200
/ that returns 404
This blog post details how you can customize your NGINX Ingress default backend.
However, if you want a specific dummy backend application to be available on a specific path using NGINX Ingress, you can simply create a Deployment with the dummy application's container image, expose it using a Service and mention the Service in spec.rules[].http.paths[].backend.service.name of your Ingress resource.
For example,
Create a Dockerfile with the following content:
FROM nginx
EXPOSE 80
RUN echo "This is a dummy website" > /usr/share/nginx/html/index.html
Build the container image using docker build -t <your-repository>/<image-name>:<tag> /path/to/folder/with/Dockerfile
Push the container image to your repository using docker push <your-repository>/<image-name>:<tag>
Create a Deployment using the image with kubectl create deploy $DeploymentName --image <your-repository>/<image-name>:<tag> -n <namespace>
Expose the Deployment using kubectl expose deploy $DeploymentName --name $ServiceName --port 80
Add the following under spec.rules of your Ingress resource.
- http:
paths:
- path: <your-ingress-path>
pathType: Prefix
backend:
service:
name: $ServiceName
port:
number: 80
When you have your final Service later, you can simply change $ServiceName with the desired Service name and the port.number with the appropriate value, using kubectl edit ingress.
For more information Kubernetes Ingress please check here.
Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as convenient to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
Hope this helps.
Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.
8 people are following this question.