Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 130ff7f

Browse files
Kalyan Reddy DaidaKalyan Reddy Daida
Kalyan Reddy Daida
authored and
Kalyan Reddy Daida
committed
Welcome to Stack Simplify
1 parent 39c539c commit 130ff7f

File tree

3 files changed

+60
-3
lines changed

3 files changed

+60
-3
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Build a Docker Image
2+
3+
## Step-01: Pre-requisite Step
4+
- Create your Docker hub account.
5+
- https://hub.docker.com/
6+
- **Important Note**: In the below listed commands wherever you see **stacksimplify** you can replace with your docker hub account id.
7+
8+
9+
## Step-02: Create Dockerfile and copy our customized nginx default.conf
10+
- **Dockerfile**
11+
```Dockerfile
12+
FROM nginx
13+
COPY default.conf /etc/nginx/conf.d
14+
```
15+
- **default.conf**
16+
- Replace your backend cluster-ip service name and port in `proxy_pass`
17+
```conf
18+
server {
19+
listen 80;
20+
server_name localhost;
21+
location / {
22+
# Update your backend application Kubernetes Cluster-IP Service name and port below
23+
# proxy_pass http://<Backend-ClusterIp-Service-Name>:<Port>;
24+
proxy_pass http://my-backend-service:8080;
25+
}
26+
error_page 500 502 503 504 /50x.html;
27+
location = /50x.html {
28+
root /usr/share/nginx/html;
29+
}
30+
}
31+
```
32+
33+
## Step-03: Build Docker Image & run it
34+
```
35+
# Build Docker Image
36+
docker build -t stacksimplify/kube-frontend-nginx:1.0.0 .
37+
38+
# Replace your docker hub account Id
39+
docker build -t <your-docker-hub-id>/kube-frontend-nginx:1.0.0 .
40+
```
41+
42+
## Step-04: Push the Docker image to docker hub
43+
```
44+
# Push Docker Image to Docker Hub
45+
docker push stacksimplify/kube-frontend-nginx:1.0.0
46+
47+
# Replace your docker hub account Id
48+
docker push <your-docker-hub-id>/kube-frontend-nginx:1.0.0
49+
```
50+
51+
## Step-05: Verify the same on docker hub
52+
- Login to docker hub and verify the image we have pushed
53+
- Url: https://hub.docker.com/repositories

‎00-Docker-Images/03-kube-frontend-nginx/V1-Release/default.conf‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ server {
1111
#}
1212

1313
location / {
14+
# Update your backend application Kubernetes Cluster-IP Service name and port below
15+
# proxy_pass http://<Backend-ClusterIp-Service-Name>:<Port>;
1416
proxy_pass http://my-backend-service:8080;
1517
}
1618

‎05-Services-with-kubectl/README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ Observation: We don't need to specify "--type=ClusterIp" because default setting
3232
- We have implemented **NodePort Service** multiple times so far (in pods, replicasets and deployments), even then we are going to implement one more time to get a full architectural view in relation with ClusterIp service.
3333
- Create a deployment for Frontend Application (Nginx acting as Reverse Proxy)
3434
- Create a NodePort service for load balancing frontend application.
35-
- **Important Note:** In Nginx reverse proxy, ensure backend service name "my-backend-service" is updated when you are building the frontend container. We already built it and put ready for this demo (stacksimplify/kube-frontend-nginx:1.0.0)
35+
- **Important Note:** In Nginx reverse proxy, ensure backend service name `my-backend-service` is updated when you are building the frontend container. We already built it and put ready for this demo (stacksimplify/kube-frontend-nginx:1.0.0)
36+
- **Docker Image Location:** https://hub.docker.com/repository/docker/stacksimplify/kube-frontend-nginx
3637
```
3738
# Create Deployment for Backend Rest App
3839
kubectl create deployment my-frontend-nginx-app --image=stacksimplify/kube-frontend-nginx:1.0.0
@@ -59,15 +60,16 @@ http://<node1-public-ip>:<Node-Port>/hello
5960
server {
6061
listen 80;
6162
server_name localhost;
62-
6363
location / {
64+
# Update your backend application Kubernetes Cluster-IP Service name and port below
65+
# proxy_pass http://<Backend-ClusterIp-Service-Name>:<Port>;
6466
proxy_pass http://my-backend-service:8080;
6567
}
66-
6768
error_page 500 502 503 504 /50x.html;
6869
location = /50x.html {
6970
root /usr/share/nginx/html;
7071
}
72+
}
7173
```
7274

7375
## Pending Topics

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /