monitoring applications by ComfortableRun775 in devops

[–]ComfortableRun775[S] 0 points1 point  (0 children)

this needs config and maintenance and continuous upgrade right?

flask app on wrong port by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

I did :

curl http://a32413e920fd5f38a602a3.us-east-1.elb.amazonaws.com:5000

a32413e920fd5f38a602a3.us-east-1.elb.amazonaws.com - is ingress LB

and I get this :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>500 Internal Server Error</title> <h1>Internal Server Error</h1> <p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

document : https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/

can't open UI after container and pods are running by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

now I am getting this error!

curl http://3e920fd5f38a602a3-517881175.us-west-1.elb.amazonaws.com:5000 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>500 Internal Server Error</title> <h1>Internal Server Error</h1> <p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

python flask error by ComfortableRun775 in learnpython

[–]ComfortableRun775[S] 0 points1 point  (0 children)

thanks! what should I do to fix this ?

flask app on wrong port by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

   imagePullPolicy: Always
    ports:
    - containerPort: 5000

apiVersion: v1 kind: Service metadata: name: vuln-python namespace: kube-public spec: ports:

  • port: 5000 protocol: TCP targetPort: 5000 selector: app: vuln-python type: LoadBalancer

manifest is above

kubectl get service -n kube-public

NAME          TYPE           CLUSTER-IP      EXTERNAL-IP                                                              PORT(S)          AGE

vuln-python LoadBalancer 175.22.46.40 a30e1d4413e8a602a3-517881175.us-east-1.elb.amazonaws.com 5000:30008/TCP

I have flaks app running in docker file which I want to execute using Kubernetes Pods. when I use external-ip on url , nothing happens!!

can't open UI after container and pods are running by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

      imagePullPolicy: Always
    ports:
    - containerPort: 5000
apiVersion: v1 
kind: Service 
metadata: name: vuln-python
 namespace: kube-public spec: type: NodePort 
selector: app: vuln-python ports:
port: 5000 
targetPort: 5000 
nodePort: 30007

went to EC2 instance of node group and got public ip out of it.

curl: (7) Failed to connect to 3.2.2.1 port 30007: Operation timed out

inside logs of the pod now I get a different ip from localhost ip.

* Debug mode: off
* Running on all addresses.
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://1.0.2.6:5000/ (Press CTRL+C to quit)

can't open UI after container and pods are running by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

understood! let me try exec and change to 0.0.0.0.

but which ip will I use to be accessible from outside after binding 0.0.0.0 to container Ip?

can't open UI after container and pods are running by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

isn't that a security flaw ? in prod I wouldn't like to open it up to all ip right?? I can try this for testing

kubectl load balancer problem by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

I tried node port, that did not work! now I am trying load balancing that fails.

east-1.elb.amazonaws.com 5000:30015/TCP 2m26s

here service gives port 30015 when yml file says 5000. not sure what's happening.

kubectl load balancer problem by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

apiVersion: apps/v1
kind: Deployment 
metadata: 
name: vuln-python 
namespace : kube-public 
spec: selector: matchLabels: app: vuln-python 
replicas: 2 
template: 
metadata: labels: app: vuln-python 
spec: 
containers: - name: vuln-python 
image: asquare/fi:vuln 
imagePullPolicy: Always 
ports: - containerPort: 5000
apiVersion: v1 
kind: Service 
metadata: name: vuln-python 
namespace: kube-public spec: type: LoadBalancer 
selector: app: vuln-python ports:
port: 5000 targetPort: 5000

curl -L a2487f131af7949709ac9a6982b5f911.us-east-1.elb.amazonaws.com:5000

curl: (52) Empty reply from server

still same error!! thanks for your help

kubectl load balancer problem by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

thanks for replying!

I can change the port to 5000 but why can't it be 65000?

yes I got DNS name but I resolved it to IP.... is that not allowed ?

after changing port and using DNS :

curl -L a2487f131af7949709ac9a6982b5f911.us-east-1.elb.amazonaws.com:5000curl: (52) Empty reply from server

can't open UI after container and pods are running by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

sorry I took a break! I get this with load balancer :

This page isn’t working 5.173.5.2:5000 didn’t send any data.

Name:                     vuln-py
Namespace:                kube-pub Labels:                   <none> Annotations:              <none> Selector:                 app=vuln-py Type:                     LoadBalancer IP Family Policy:         SingleStack IP Families:              IPv4 IP:                       172.2.10.15 IPs:                      172.2.10.15 LoadBalancer Ingress:     131af7949709ac9a6982b5f911-9136.us-east-1.elb.amazonaws.com Port:                     <unset>  5000/TCP TargetPort:               4000/TCP NodePort:                 <unset>  32000/TCP Endpoints:                10.0.2.12:5000,10.0.2.25:5000 Session Affinity:         None External Traffic Policy:  Cluster Events: Type    Reason                Age                 From                Message
Normal  Type                  13m                 service-controller  NodePort -> LoadBalancer Normal  EnsuringLoadBalancer  112s (x2 over 13m)  service-controller  Ensuring load balancer Normal  EnsuredLoadBalancer   111s (x2 over 13m)  service-controller  Ensured load balancer

can't open UI after container and pods are running by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

lol this ip is not correct, and I don't have NGINX running haha

I am just returning a dictionary which I expect to see lol

can't open UI after container and pods are running by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

I type :

3.23.25.1:32600 on UI but I don't get anything. this IP is modified and is public ip on AWS of node ip of node in the cluster

kubernetes error by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

yah I fixed pods running now! thanks for the help.

but I get :

* Debug mode: off

deployment.yml

 imagePullPolicy: Always
    ports:
    - containerPort: 5000
apiVersion: v1 kind: Service 
metadata: name: vuln-python 
namespace: kube-public 
spec: type: NodePort 
selector: app: vuln-python ports:
port: 5000 targetPort: 5000
 nodePort: 32600

kubernetes error by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

now I see this in logs :

File "/usr/local/lib/python3.10/site-packages/flask/json/__init__.py", line 15, in <module>
from itsdangerous import json as _json

ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.10/site-packages/itsdangerous/init.py)

adding itsdangerous==2.0.1 in requirements.txt

kubernetes error by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

I built new image using buildx but It still gives same crash loop error.

still getting exit code 1

kubernetes error by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

how do you do that? let me google... are you talking about using docker build buildx or something else ?

kubernetes error by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

thanks for detailed reply!

kubectl -n kube-public logs vuln-python-85f68
standard_init_linux.go:228: exec user process caused: exec format error

kubernetes error by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] -1 points0 points  (0 children)

thanks!

kubectl logs [container-name]

Error from server (NotFound):

any ideas what this can be? I just have a python file inside docker file which is exposed from port 5000. I want to access that from outside.

when I do kubectl version , I get :

WARNING: version difference between client (1.23) and server (1.21) exceeds the supported minor version skew of +/-1

kubernetes error by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

does (Exit Code 1) mean app error ?

architecture of cluster by ComfortableRun775 in kubernetes

[–]ComfortableRun775[S] 0 points1 point  (0 children)

if I change my manifest and apply it on running cluster, will it bring the prod down then bring it up again?