|
| 1 | +# Kubernetes |
| 2 | + |
| 3 | +## Manual setup |
| 4 | + |
| 5 | +``` |
| 6 | +$ kubectl get pods,svc |
| 7 | +NAME READY STATUS RESTARTS AGE |
| 8 | +pod/web-app-py-64bf47b878-9gb7c 1/1 Running 0 62s |
| 9 | +
|
| 10 | +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
| 11 | +service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 22m |
| 12 | +service/web-app-py LoadBalancer 10.109.167.161 <pending> 80:30520/TCP 39s |
| 13 | +``` |
| 14 | + |
| 15 | +## Manifest-based setup |
| 16 | + |
| 17 | +``` |
| 18 | +$ kubectl get pods,svc |
| 19 | +NAME READY STATUS RESTARTS AGE |
| 20 | +pod/web-app-py-54bf57f5d4-g8ktf 1/1 Running 0 3m23s |
| 21 | +pod/web-app-py-54bf57f5d4-k8ngh 1/1 Running 0 3m23s |
| 22 | +pod/web-app-py-54bf57f5d4-p4d6p 1/1 Running 0 3m23s |
| 23 | +
|
| 24 | +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
| 25 | +service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 4m43s |
| 26 | +service/web-app-py LoadBalancer 10.105.228.85 <pending> 5000:31951/TCP 3m23s |
| 27 | +$ minikube service --all |
| 28 | +|-----------|------------|-------------|--------------| |
| 29 | +| NAMESPACE | NAME | TARGET PORT | URL | |
| 30 | +|-----------|------------|-------------|--------------| |
| 31 | +| default | kubernetes | | No node port | |
| 32 | +|-----------|------------|-------------|--------------| |
| 33 | +😿 service default/kubernetes has no node port |
| 34 | +|-----------|------------|-------------|---------------------------| |
| 35 | +| NAMESPACE | NAME | TARGET PORT | URL | |
| 36 | +|-----------|------------|-------------|---------------------------| |
| 37 | +| default | web-app-py | 5000 | http://192.168.49.2:31951 | |
| 38 | +|-----------|------------|-------------|---------------------------| |
| 39 | +🎉 Opening service default/web-app-py in default browser... |
| 40 | +Opening in existing browser session. |
| 41 | +$ |
| 42 | +``` |
| 43 | + |
| 44 | +## Ingress |
| 45 | + |
| 46 | +``` |
| 47 | +$ curl --resolve "kolay.ne:80:$( minikube ip )" --verbose http://kolay.ne/ ; echo |
| 48 | +* Added kolay.ne:80:192.168.49.2 to DNS cache |
| 49 | +* Hostname kolay.ne was found in DNS cache |
| 50 | +* Trying 192.168.49.2:80... |
| 51 | +* Connected to kolay.ne (192.168.49.2) port 80 |
| 52 | +> GET / HTTP/1.1 |
| 53 | +> Host: kolay.ne |
| 54 | +> User-Agent: curl/8.7.1 |
| 55 | +> Accept: */* |
| 56 | +> |
| 57 | +* Request completely sent off |
| 58 | +< HTTP/1.1 404 Not Found |
| 59 | +< Date: Fri, 29 Mar 2024 13:58:46 GMT |
| 60 | +< Content-Type: text/html |
| 61 | +< Content-Length: 146 |
| 62 | +< Connection: keep-alive |
| 63 | +< |
| 64 | +<html> |
| 65 | +<head><title>404 Not Found</title></head> |
| 66 | +<body> |
| 67 | +<center><h1>404 Not Found</h1></center> |
| 68 | +<hr><center>nginx</center> |
| 69 | +</body> |
| 70 | +</html> |
| 71 | +* Connection #0 to host kolay.ne left intact |
| 72 | +
|
| 73 | +$ curl --resolve "kolay.ne:80:$( minikube ip )" --verbose http://kolay.ne/time ; echo |
| 74 | +* Added kolay.ne:80:192.168.49.2 to DNS cache |
| 75 | +* Hostname kolay.ne was found in DNS cache |
| 76 | +* Trying 192.168.49.2:80... |
| 77 | +* Connected to kolay.ne (192.168.49.2) port 80 |
| 78 | +> GET /time HTTP/1.1 |
| 79 | +> Host: kolay.ne |
| 80 | +> User-Agent: curl/8.7.1 |
| 81 | +> Accept: */* |
| 82 | +> |
| 83 | +* Request completely sent off |
| 84 | +< HTTP/1.1 200 OK |
| 85 | +< Date: Fri, 29 Mar 2024 13:58:51 GMT |
| 86 | +< Content-Type: text/html; charset=utf-8 |
| 87 | +< Content-Length: 60 |
| 88 | +< Connection: keep-alive |
| 89 | +< |
| 90 | +* Connection #0 to host kolay.ne left intact |
| 91 | +In MSK it's 16:57:49. Have you brushed your teeth today yet? |
| 92 | +$ curl --resolve "kolay.ne:80:$( minikube ip )" --verbose http://kolay.ne/cats ; echo |
| 93 | +* Added kolay.ne:80:192.168.49.2 to DNS cache |
| 94 | +* Hostname kolay.ne was found in DNS cache |
| 95 | +* Trying 192.168.49.2:80... |
| 96 | +* Connected to kolay.ne (192.168.49.2) port 80 |
| 97 | +> GET /cats HTTP/1.1 |
| 98 | +> Host: kolay.ne |
| 99 | +> User-Agent: curl/8.7.1 |
| 100 | +> Accept: */* |
| 101 | +> |
| 102 | +* Request completely sent off |
| 103 | +< HTTP/1.1 200 OK |
| 104 | +< Date: Fri, 29 Mar 2024 13:58:56 GMT |
| 105 | +< Content-Type: text/plain; charset=utf-8 |
| 106 | +< Content-Length: 162 |
| 107 | +< Connection: keep-alive |
| 108 | +< |
| 109 | +* Connection #0 to host kolay.ne left intact |
| 110 | +There is a species of cat smaller than the average housecat. It is native to Africa and it is the Black-footed cat (Felis nigripes). Its top weight is 5.5 pounds. |
| 111 | +$ |
| 112 | +``` |
| 113 | + |
| 114 | +Note: 5.5 pounds is about 2.49 kilograms |
0 commit comments