Skip to content

Commit 764294b

Browse files
committed
fix: docs
1 parent 7105b20 commit 764294b

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ Follow guide: [Mac Setup Gitbook](https://xmlking.gitbook.io/macos-setup/)
2323
- <https://github.com/micro/micro/blob/master/network/config/kubernetes/gcloud.md>
2424
- [My Ultimate M1 Mac Developer Setup](https://codeburst.io/my-ultimate-m1-mac-developer-setup-cfdb2daeed2d)
2525
- [Sourabhbajaj's macOS Setup Guide](https://sourabhbajaj.com/mac-setup/index.html)
26-
- <https://www.stefanjudis.com/blog/declutter-emojify-and-prettify-your-iterm2-terminal>
2726
- [Te BEST Mac Terminal Setup for 2022](https://bdarfler.medium.com/the-best-mac-terminal-setup-for-2022-44bf6e3c1a6e)
2827
- [Everduin94 dotfiles](https://github.com/Everduin94/dotfiles)

docs/devops/kubernetes.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ kubens -
2424
```
2525

2626
### k9s
27+
2728
Kubernetes CLI To Manage Your Clusters In Style!
29+
2830
```shell
2931
k9s
3032
```
33+
3134
### Kubectl commands
35+
>
3236
> commonly used Kubectl commands
3337
3438
> you can pratice kubectl commands at [katacoda](https://www.katacoda.com/courses/kubernetes/playground) playground
@@ -62,6 +66,7 @@ kubectl get po --all-namespaces | awk '{if ($4 ~ /Evicted/) system ("kubectl -n
6266
### Namespaces and Context
6367

6468
> Execute the kubectl Command for Creating Namespaces
69+
6570
```shell
6671
# Namespace for Developers
6772
kubectl create -f namespace-dev.json
@@ -72,6 +77,7 @@ kubectl create -f namespace-prod.json
7277
```
7378

7479
> Assign a Context to Each Namespace
80+
7581
```
7682
# Assign dev context to development namespace
7783
kubectl config set-context dev --namespace=dev --cluster=minikube --user=minikube
@@ -82,6 +88,7 @@ kubectl config set-context prod --namespace=prod --cluster=minikube --user=minik
8288
```
8389

8490
> Switch to the Appropriate Context
91+
8592
```
8693
# List contexts
8794
kubectl config get-contexts
@@ -96,9 +103,11 @@ kubectl config current-context
96103
```
97104

98105
> see cluster-info
106+
99107
```shell
100108
kubectl cluster-info
101109
```
110+
102111
> nested kubectl commands
103112
104113
```shell
@@ -115,6 +124,7 @@ curl http://localhost:8080/api/v1/namespaces/default/pods
115124
```
116125

117126
### Accessing logs
127+
118128
```shell
119129
# get all the logs for a given pod:
120130
kubectl logs my-pod-name
@@ -127,20 +137,25 @@ kubectl alpha diff -f mything.yml
127137
```
128138

129139
### Execute commands in running Pods
140+
130141
```shell
131142
kubectl exec -it my-pod-name -- /bin/sh
132143
```
133144

134145
### CI/CD
146+
>
135147
> Redeploy newly build image to existing k8s deployment
148+
136149
```
137150
BUILD_NUMBER = 1.5.0-SNAPSHOT // GIT_SHORT_SHA
138151
kubectl diff -f sample-app-deployment.yaml
139152
kubectl -n=staging set image -f sample-app-deployment.yaml sample-app=xmlking/ngxapp:$BUILD_NUMBER
140153
```
141154

142155
### Rolling back deployments
156+
>
143157
> Once you run `kubectl apply -f manifest.yml`
158+
144159
```shell
145160
# To get all the deploys of a deployment, you can do:
146161
kubectl rollout history deployment/DEPLOYMENT-NAME
@@ -151,6 +166,7 @@ kubectl rollout undo deployment/DEPLOYMENT_NAME
151166
```
152167

153168
### Tips and Tricks
169+
154170
```shell
155171
# Show resource utilization per node:
156172
kubectl top node
@@ -162,7 +178,8 @@ watch kubectl top node
162178
kubectl get po --v=8
163179
```
164180

165-
#### troubleshoot headless services
181+
#### troubleshoot headless services
182+
166183
```shell
167184
k get ep
168185
# ssh to one of the container and run dns check:
@@ -190,6 +207,7 @@ bb sh
190207
```
191208

192209
> after SSH to a container, you can use this command to check connectivity to external host
210+
193211
```shell
194212
# install netcat only if missing
195213
apt update && apt -y install netcat
@@ -199,7 +217,9 @@ nc -zv some_egress_hostname 1433
199217
```
200218

201219
#### Container Security
220+
>
202221
> for better security add following securityContext settings to manifest
222+
203223
```yaml
204224
securityContext:
205225
# Blocking Root Containers
@@ -214,10 +234,10 @@ securityContext:
214234
add: ["NET_BIND_SERVICE"]
215235
```
216236
217-
218237
#### Debug k8s
219238
220239
For many steps here you will want to see what a `Pod` running in the k8s cluster sees. The simplest way to do this is to run an interactive busybox `Pod`:
240+
221241
```shell
222242
kubectl run -it --rm --restart=Never busybox --image=busybox sh
223243
```
@@ -253,20 +273,21 @@ kubectl get secret keycloak-secrets-tls-o jsonpath="{.data.tls.crt}" | base64 --
253273
yq '.data."tls.crt"' keycloak-secrets-tls.yml | base64 --decode
254274
```
255275

256-
#### iTerm2 tips
257-
> in iTerm2
276+
#### Ghostty tips
277+
>
278+
> in Ghostty
279+
258280
1. split screen horizontally
259281
2. go to the bottom screen and split it vertically
260282

261283
I was using top screen for the work with yaml files and kubectl.
262284

263285
Left bottom screen was running:
264286

265-
watch kubectl get pods
287+
watch kubectl get pods
266288

267289
Right bottom screen was running:
268290

269-
watch "kubectl get events --sort-by='{.lastTimestamp}' | tail -6"
291+
watch "kubectl get events --sort-by='{.lastTimestamp}' | tail -6"
270292

271293
With such setup it was easy to observe in real time how my pods are being created.
272-

dotfiles/.zshrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# iterm shell integration
2-
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" || true
3-
41
# use starship prompt
52
if type starship &>/dev/null; then
63
eval "$(starship init zsh)"

0 commit comments

Comments
 (0)