Skip to content

Commit 937f5f5

Browse files
authored
doc: add the kubectl usage (#116)
2 parents 623b162 + dfeefc3 commit 937f5f5

File tree

5 files changed

+90
-3
lines changed

5 files changed

+90
-3
lines changed

docs/usage/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ This guide us how to use the `devops-toolkit` with serveral usecases
1414

1515
- Check [**terraform_usage**](./terraform_usage.md)
1616

17+
## Kubectl
18+
19+
- Check [**kubectl_usage**](./kubectl_usage.md)
20+
1721
## Troubleshooting
1822

1923
- For any issues, check [this document](../troubleshooting/TROUBLESHOOTING.md)

docs/usage/ansible_usage.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Use ansible in the devops-toolkit
22

3-
To use the existing container isntead of creating one, use `docker exec` command instead of `docker run`
3+
## Ansible document
4+
5+
Some document to help you start with ansible
6+
7+
- <https://github.com/tungbq/devops-basic/tree/main/topics/ansible>
8+
- <https://www.ansible.com/>
9+
10+
## Note
11+
12+
To use the existing container instead of creating one, use `docker exec` command instead of `docker run`
413

514
```bash
615
docker exec -it my_devops_toolkit /bin/bash

docs/usage/kubectl_usage.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Use kubectl in the devops-toolkit
2+
3+
## Kubernetes document
4+
5+
Some document to help you start with kubernetes (k8s)
6+
7+
- <https://kubernetes.io/docs/home/>
8+
- <https://github.com/tungbq/devops-basic/tree/main/topics/k8s>
9+
10+
To use the existing container instead of creating one, use `docker exec` command instead of `docker run`
11+
12+
```bash
13+
docker exec -it my_devops_toolkit /bin/bash
14+
```
15+
16+
## Use case 1: Use kubeconfig from the host
17+
18+
Mount the `.kube/config` file from the host to container
19+
20+
```bash
21+
docker run --rm --network host -it -v ~/.kube/config:/root/.kube/config devops-toolkit:latest
22+
###############################################
23+
# Now we are in the docker container terminal #
24+
###############################################
25+
kubectl get nodes
26+
27+
# Deploy application
28+
kubectl apply -f https://k8s.io/examples/application/deployment.yaml
29+
# View the pod
30+
kubectl get pods -w
31+
# View the deployment
32+
kubectl get deployment
33+
# More command as per your need...
34+
```
35+
36+
Sample Result
37+
38+
```bash
39+
~ docker run --rm --network host -it -v ~/.kube/config:/root/.kube/config devops-toolkit:latest
40+
root@docker-desktop:~# kubectl get nodes
41+
NAME STATUS ROLES AGE VERSION
42+
kind-control-plane Ready control-plane 21m v1.29.2
43+
root@docker-desktop:~# kubectl apply -f https://k8s.io/examples/application/deployment.yaml
44+
deployment.apps/nginx-deployment unchanged
45+
root@docker-desktop:~# kubectl get pods -w
46+
NAME READY STATUS RESTARTS AGE
47+
nginx-deployment-86dcfdf4c6-c2cfp 1/1 Running 0 99s
48+
nginx-deployment-86dcfdf4c6-w4vp7 1/1 Running 0 99s
49+
root@docker-desktop:~# kubectl get deployment
50+
NAME READY UP-TO-DATE AVAILABLE AGE
51+
nginx-deployment 2/2 2 2 115s
52+
```
53+
54+
## Troubleshooting
55+
56+
- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md)

docs/usage/python_usage.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Use python in the devops-toolkit
22

3-
To use the existing container isntead of creating one, use `docker exec` command instead of `docker run`
3+
## Python document
4+
5+
Some document to help you start with python
6+
7+
- <https://www.python.org/doc/>
8+
- <https://github.com/tungbq/devops-basic/tree/main/topics/python>
9+
10+
## Note
11+
12+
To use the existing container instead of creating one, use `docker exec` command instead of `docker run`
413

514
```bash
615
# Given that we have 'my_devops_toolkit' start before

docs/usage/terraform_usage.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Use terraform in the devops-toolkit
22

3-
To use the existing container isntead of creating one, use `docker exec` command instead of `docker run`
3+
## Terraform document
4+
5+
Some document to help you start with terraform
6+
7+
- <https://developer.hashicorp.com/terraform>
8+
- <https://github.com/tungbq/devops-basic/tree/main/topics/terraform>
9+
10+
## Note
11+
12+
To use the existing container instead of creating one, use `docker exec` command instead of `docker run`
413

514
```bash
615
docker exec -it my_devops_toolkit /bin/bash

0 commit comments

Comments
 (0)