{"id":28401040,"url":"https://github.com/surajkumar4-source/first_deployment_in_k8s","last_synced_at":"2026-01-28T23:33:24.787Z","repository":{"id":262668780,"uuid":"887968309","full_name":"Surajkumar4-source/First_Deployment_in_K8S","owner":"Surajkumar4-source","description":"This guide covers deploying an HTTPD server in Kubernetes, exposing it via a NodePort service for external access, and scaling it up or down to handle varying loads efficiently.","archived":false,"fork":false,"pushed_at":"2025-01-28T17:06:38.000Z","size":522,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T19:18:27.260Z","etag":null,"topics":["deployment-services","k8s-cluster","kubectl","nodeport","scalling"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Surajkumar4-source.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-13T15:34:55.000Z","updated_at":"2025-04-02T06:28:16.000Z","dependencies_parsed_at":"2024-11-15T08:48:34.500Z","dependency_job_id":null,"html_url":"https://github.com/Surajkumar4-source/First_Deployment_in_K8S","commit_stats":null,"previous_names":["surajkumar4-source/first_deployment_in_k8s"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Surajkumar4-source/First_Deployment_in_K8S","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Surajkumar4-source%2FFirst_Deployment_in_K8S","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Surajkumar4-source%2FFirst_Deployment_in_K8S/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Surajkumar4-source%2FFirst_Deployment_in_K8S/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Surajkumar4-source%2FFirst_Deployment_in_K8S/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Surajkumar4-source","download_url":"https://codeload.github.com/Surajkumar4-source/First_Deployment_in_K8S/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Surajkumar4-source%2FFirst_Deployment_in_K8S/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28855163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T22:56:21.783Z","status":"ssl_error","status_checked_at":"2026-01-28T22:56:00.861Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deployment-services","k8s-cluster","kubectl","nodeport","scalling"],"created_at":"2025-06-01T11:37:54.392Z","updated_at":"2026-01-28T23:33:24.781Z","avatar_url":"https://github.com/Surajkumar4-source.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deploying and Exposing an HTTPD Server Using 'kubectl'\n\n### This guide walks through creating a deployment for an HTTPD server (`suraj-app`) and exposing it using a NodePort service to enable external access.\n### The steps also include scaling the deployment up and down to handle varying loads.\n\n\n\u003cbr\u003e\n\n## Follow the Steps to Implement\n\n### 1. Create the Deployment\n- To start, create a deployment named `suraj-app` using the official `httpd` image.\n\n```yml\nkubectl create deployment suraj-app --image=httpd\n```\n\n*This command initializes a deployment named suraj-app using the HTTPD image, which serves as our web server.*\n\n### 2. Expose the Deployment via NodePort Service.\n\n- Expose the deployment to allow external access through a NodePort service.\n\n ```yml\n\n  kubectl expose deployment suraj-app --type=NodePort --port=80 --name=suraj-service\n\n```\n\n*This command creates a service named suraj-service that allows external traffic on port 80 by assigning a random NodePort.*\n\n### 3. Verify the NodePort\n- To confirm the assigned NodePort and external accessibility details, use:\n\n ```yml\n  \n  kubectl get svc suraj-service\n\n```\n*Look under the PORT(S) column to see the NodePort assigned, which will look like 80:\u003cNodePort\u003e/TCP.*\n\n### 4. Access the Service Externally\n- Access the service from outside the cluster using the cluster node's IP and the assigned NodePort. For example:\n\n```yml\nhttp://\u003cNODE_IP\u003e:\u003cNodePort\u003e\n```\n\n*Replace \u003cNODE_IP\u003e with your cluster's external IP and \u003cNodePort\u003e with the actual port obtained from the previous step.*\n\n\n\n### 5. Scale the Deployment\n- Adjust the deployment’s number of replicas as needed to manage workload:\n\n#### a. Scale Up\n- To increase the number of replicas to 10:\n\n```yml\n\nkubectl scale deployment suraj-app --replicas=10\n\n```\n*This command scales up the deployment, creating additional pods for suraj-app.*\n\n- Verify the scaling:\n```yml\n\nkubectl get deployment suraj-app\nkubectl get pods -o wide\n\n```\n\n#### b. Scale Down\n- To decrease the replicas to 5:\n\n```yml\nkubectl scale deployment suraj-app --replicas=5\n\n```\n- Verify the new count:\n  \n```yml\n\nkubectl get deployment suraj-app\nkubectl get pods -o wide\n\n```\n\n\n\n## Explanation of Scaling\n- Scaling Up: Creates more pods to distribute the load and ensure high availability.\n- Scaling Down: Reduces the number of running pods, saving resources when demand is lower.\n\n\n*This setup deploys a scalable HTTPD server accessible from outside the cluster, allowing you to manage the web server load efficiently.*\n\n\n\n\n\n\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n\n## ------------------Screnshots--------------------\n1.\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n![Alt text for image](screenshots/1.png)\n\n2.\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n![Alt text for image](screenshots/3.png)\n\n\n3.\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n![Alt text for image](screenshots/4.png)\n\n4.\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n![Alt text for image](screenshots/5.png)\n\n5.\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n![Alt text for image](screenshots/6.png)\n\n\n6.\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n\n![Alt text for image](screenshots/7.png)\n\n\n7.\n\u003cbr\u003e\n\n### Final Output: *at localhost*\n\n\u003cbr\u003e\n\n\n\n![Alt text for image](screenshots/2.png)\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n\n**👨‍💻 𝓒𝓻𝓪𝓯𝓽𝓮𝓭 𝓫𝔂**: [Suraj Kumar Choudhary](https://github.com/Surajkumar4-source) | 📩 **𝓕𝓮𝓮𝓵 𝓯𝓻𝓮𝓮 𝓽𝓸 𝓓𝓜 𝓯𝓸𝓻 𝓪𝓷𝔂 𝓱𝓮𝓵𝓹**: [csuraj982@gmail.com](mailto:csuraj982@gmail.com)\n\n\n\n\n\n\u003cbr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurajkumar4-source%2Ffirst_deployment_in_k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurajkumar4-source%2Ffirst_deployment_in_k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurajkumar4-source%2Ffirst_deployment_in_k8s/lists"}