Deploy Nginx Service in Kubernetes
To deploy Nginx in Kubernetes and make it accessible from external sources, you need to follow a few steps:
Nginx service Deployment
Prerequisites
You have to set the Kubernetes cluster to follow these links.
Access the Kubernetes Master Node
To access the master node in a Kubernetes cluster, follow these LINK:
Open a terminal session.
Use the SSH protocol to connect:
Replace user
with your username and master-node-address
with the IP address or hostname of the master node.
Enter your password or authenticate with your SSH key when prompted.
Once connected, you can perform administrative tasks on the Kubernetes master node.
Create a Deployment: Define a Kubernetes Deployment manifest to specify the desired state for the Nginx deployment.
Expose the Deployment: Expose the Nginx Deployment through a Kubernetes Service of type NodePort or LoadBalancer.
Access from External Sources: Access the Nginx service using the assigned NodePort or the external IP if you're using a LoadBalancer.
Here is a step-by-step guide
First, check your nodes Check the status of your nodes
Create a Deployment YAML File (deployment.yaml)
Create a Service YAML File (service.yaml)
Apply the YAML file to create the Nginx Service
Once you have created this manifest (deployment.yaml , service.yaml for example ), you can apply it to your Kubernetes cluster using the following command:
Check the status of your service using:
Once the external IP is assigned, you can use it to access your application.
For detailed information about the service, run:
When you create a LoadBalancer Service in Kubernetes for your NGINX deployment, an external IP address is automatically allocated. This allows you to access NGINX from any location using the given public IP.
After deploying the application and service, find the public IP of a node in the Kubernetes cluster.
To verify the service is operational, access it through the load balancer by visiting: http://load_balancer_IP.
Last updated