Skip to content

Commit 0739b33

Browse files
committed
docs(README.md): update kubernetes instructions
1 parent 0e6b1f3 commit 0739b33

File tree

2 files changed

+68
-9
lines changed

2 files changed

+68
-9
lines changed

README.md

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -758,13 +758,19 @@ docker login -u [DOCKER_HUB_USERNAME] -p [DOCKER_HUB_PASSWORD]
758758
Build your image by executing below command:
759759
760760
```bash
761-
docker build -t [DOCKER_HUB_USERNAME]/companyhouse:0.0.1 .
761+
docker build -t [DOCKER_HUB_USERNAME]/companieshouse:0.0.1 .
762762
```
763763
764764
Then push the image to the remote registry.
765765
766766
```bash
767-
docker push [DOCKER_HUB_USERNAME]/companyhouse:0.0.1
767+
docker push [DOCKER_HUB_USERNAME]/companieshouse:0.0.1
768+
```
769+
770+
or if you built with a `latest` tag.
771+
772+
```bash
773+
docker push [DOCKER_HUB_USERNAME]/companieshouse:latest
768774
```
769775
770776
Open Docker hub & validate whether the docker image has been pushed successfully.
@@ -782,7 +788,7 @@ docker images
782788
783789
Now let us pull the remote docker image:
784790
```bash
785-
docker pull [DOCKER_HUB_USERNAME]/companyhouse:0.0.1
791+
docker pull [DOCKER_HUB_USERNAME]/companieshouse:0.0.1
786792
```
787793
788794
or you can pull any other public image as pull doesn't require credentials for public images.
@@ -963,22 +969,75 @@ Further Reading:
963969
964970
#### 7.1 Kubernetes
965971
966-
**Updating instructions WIP**
972+
Before executing below commands ensure the kubernetes cluster (Rancher, Minikube, Cloud Cluster etc) is running and kubectl CLI is able to connect.
967973
968-
- Standard App Deployment
974+
> If you have your own image built and pushed to DockerHub.</br>
975+
Then open the [kubernetes/std/deployement.yaml](./kubernetes/std/deployement.yaml) and replace "image: abhisheksr01/companieshouse:latest" at Line 17 with your DOCKERHUB_USERNAME and imagename:tag
969976
970-
Source files at :
977+
For this exercise we are deploying the application on `default` namespace if you wish to change the namespace then apped `-n [NAMESPACE]` to each command executed below.
978+
979+
- Application Deployment through Kubernetes yaml config file.
980+
981+
```bash
982+
kubectl apply -f kubernetes/std/
983+
```
984+
The `Ingress` will fail if you do not have it configured (which is fine for this exercise).
985+
986+
Check if the pod is running and status is `Running`. Capture the name of the pod.
987+
988+
```bash
989+
kubectl get pods
990+
```
991+
992+
Check if the service is also running.
993+
994+
```bash
995+
kubectl get service
996+
```
997+
998+
Expose the Service through port-forward to access the application locally.
999+
1000+
```bash
1001+
kubectl port-forward [POD-NAME] 8080:8080
1002+
```
1003+
1004+
or use below command to port-forward with dynamic retrieval of the pod name.
9711005
9721006
```bash
973-
kubernetes/std/
1007+
kubectl port-forward $(kubectl get pod -l app=companies-house-microservice -o jsonpath="{.items[0].metadata.name}") 8080:8080
1008+
```
1009+
1010+
You should see an terminal log as below:
1011+
```
1012+
Forwarding from 127.0.0.1:8080 -> 8080
1013+
Forwarding from [::1]:8080 -> 8080
9741014
```
9751015
1016+
Open a web browser and open the URL: http://localhost:8080/companieshouse/swagger-ui/index.html to access the swagger UI exposed by this service.
1017+
1018+
Terminate the terminal to end the port forwarding and execute below command to remove the application deployment.
1019+
1020+
```
1021+
kubectl delete -f ./kubernetes/std/
1022+
```
1023+
1024+
1025+
- Helm Chart
1026+
1027+
Source files at :
1028+
9761029
```bash
977-
kubectl apply -f kubernetes/std/ -n [NAMESPACE]
1030+
kubernetes/helm-chart/
9781031
```
9791032
1033+
```bash
1034+
kubectl apply -f kubernetes/helm-chart/ -n [NAMESPACE]
1035+
```
1036+
9801037
- Helm Chart
9811038
1039+
[Work In Progress]
1040+
9821041
Source files at :
9831042
9841043
```bash

kubernetes/std/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
spec:
1515
containers:
1616
- name: companies-house-microservice
17-
image: abhisheksr01/companies-house-microservice:0.0.1
17+
image: abhisheksr01/companieshouse:latest
1818
ports:
1919
- containerPort: 8080
2020
imagePullPolicy: Always

0 commit comments

Comments
 (0)