From b76df887e09f94a3a227a4185bdfe6de79aa579b Mon Sep 17 00:00:00 2001 From: DylenTurnbull Date: Mon, 24 Feb 2025 15:47:13 -0800 Subject: [PATCH] nic demo files and readme --- nic/appworld/README.md | 104 +++++++++++++++++++++++++++++ nic/appworld/nginx-deployment.yaml | 38 +++++++++++ nic/appworld/nginx-ingress.yaml | 17 +++++ 3 files changed, 159 insertions(+) create mode 100644 nic/appworld/README.md create mode 100644 nic/appworld/nginx-deployment.yaml create mode 100644 nic/appworld/nginx-ingress.yaml diff --git a/nic/appworld/README.md b/nic/appworld/README.md new file mode 100644 index 0000000..c0ccd7e --- /dev/null +++ b/nic/appworld/README.md @@ -0,0 +1,104 @@ +# NGINX Ingress Controller Demo + +## Prerequisites + +### Install VSCode + +1. Go to the [VSCode download page](https://code.visualstudio.com/download). +2. Download the installer for your operating system. +3. Run the installer and follow the on-screen instructions to complete the installation. + +### Install Git + +1. Open a terminal or command prompt. +2. Run the following command to install Git using Winget: + ```shell + winget install -e --id Git.Git + ``` + +### Authenticate with GitHub + +1. Open a terminal or command prompt. +2. Configure your GitHub email: + ```shell + git config --global user.email "you@example.com" + ``` +3. Configure your GitHub username: + ```shell + git config --global user.name "Your Name" + ``` + +### Install Docker Desktop + +1. Open a terminal or command prompt. +2. Run the following command to install Docker Desktop using Winget: + ```shell + winget install -e --id Docker.DockerDesktop + ``` +3. Follow the on-screen instructions to complete the installation. + +### Install Helm + +1. Open a terminal or command prompt. +2. Run the following command to install Helm using Winget: + ```shell + winget install -e --id Helm.Helm + ``` +3. Follow the on-screen instructions to complete the installation. + +## Demo Commands + +### Add NGINX Helm Repository + +1. Open a terminal or command prompt. +2. Run the following command to add the NGINX stable Helm repository: + ```bash + helm repo add nginx-stable https://helm.nginx.com/stable + ``` + +### Update Helm Repositories + +1. Open a terminal or command prompt. +2. Run the following command to update your Helm repositories: + ```bash + helm repo update + ``` + +### Apply Kubernetes CRDs + +1. Open a terminal or command prompt. +2. Run the following command to apply the NGINX Kubernetes CRDs: + ```bash + kubectl apply -f https://raw.githubusercontent.com/nginx/kubernetes-ingress/v4.0.1/deploy/crds.yaml + ``` + +### Install NGINX Ingress Controller + +1. Open a terminal or command prompt. +2. Run the following command to install the NGINX Ingress Controller using Helm: + ```bash + helm install nginx-ingress nginx-stable/nginx-ingress --namespace default + ``` + +### Deploy NGINX Application + +1. Open a terminal or command prompt. +2. Run the following command to apply the NGINX deployment configuration: + ```bash + kubectl apply -f nginx-deployment.yaml + ``` + +### Apply NGINX Ingress Configuration + +1. Open a terminal or command prompt. +2. Run the following command to apply the NGINX ingress configuration: + ```bash + kubectl apply -f nginx-ingress.yaml + ``` + +## Demo Take Aways + +- Intalling NGINX Ingress Controller (NIC) is quick and simple to get up and functional in Kubernetes (K8s) +- NGINX web server and NIC on K8s on Docker Desktop provides a light weight low stress K8s dev environment to experiment and lean. +- Recovery from issues is as simple as performing a quick reset of K8s and a few minutes to stand up the envionment again. +- Join the community and become a contributor. \ No newline at end of file diff --git a/nic/appworld/nginx-deployment.yaml b/nic/appworld/nginx-deployment.yaml new file mode 100644 index 0000000..a292a5a --- /dev/null +++ b/nic/appworld/nginx-deployment.yaml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:latest + ports: + - containerPort: 80 + resources: + limits: + memory: "128Mi" + cpu: "500m" + requests: + memory: "64Mi" + cpu: "250m" +--- +apiVersion: v1 +kind: Service +metadata: + name: nginx-service +spec: + selector: + app: nginx + ports: + - protocol: TCP + port: 80 + targetPort: 80 diff --git a/nic/appworld/nginx-ingress.yaml b/nic/appworld/nginx-ingress.yaml new file mode 100644 index 0000000..edfd0b0 --- /dev/null +++ b/nic/appworld/nginx-ingress.yaml @@ -0,0 +1,17 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: nginx-ingress +spec: + ingressClassName: nginx + rules: + - host: localhost + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: nginx-service + port: + number: 80 \ No newline at end of file