powerful-oxygen-51624
08/23/2024, 2:15 PMpowerful-oxygen-51624
08/23/2024, 2:15 PMpowerful-oxygen-51624
08/23/2024, 2:17 PMpython_sources(
name="src_files",
sources=["src/pages/**"],
)
resources(
name="assets",
sources=["src/resources/**", "src/assets/**"],
)
files(
name="asset_files",
sources=["src/resources/**", "src/assets/**"],
)
pex_binary(
name="main",
environment=parametrize("osx", "linux_docker"),
entry_point="src/index.py",
dependencies=[":src_files", ":assets"],
)
docker_image(
name="midas-gui",
instructions=[
"FROM python:3.11-slim-buster",
"EXPOSE 8050",
"COPY src/quant/src/services/gui/src/resources /bin/resources",
"COPY src.quant.src.services.gui/main@environment=linux_docker.pex /bin",
# 'ENTRYPOINT ["sh", "-c", "while true; do echo Running; sleep 1; done"]',
'ENTRYPOINT ["/bin/main@environment=linux_docker.pex"]',
],
registries=[
"@ecr-registry",
],
image_tags=["{build_args.GIT_COMMIT}"],
dependencies=[":asset_files"],
)
python_sources()
careful-address-89803
08/25/2024, 2:38 AMEXPOSE
doesn't actually publish the port (although docker desktop might parse it and be helpful), and if the port isn't in ...spec.containers[*].ports
it won't be exposed and an ingress won't be able to connect to itpowerful-oxygen-51624
08/26/2024, 12:21 PMapiVersion: apps/v1
kind: Deployment
metadata:
name: midas-gui-deployment
labels:
app: midas-gui
spec:
replicas: 1
selector:
matchLabels:
app: midas-gui
template:
metadata:
labels:
app: midas-gui
spec:
serviceAccountName: dev-midas-gui
containers:
- name: midas-gui
image: xxx
imagePullPolicy: Always
ports:
- containerPort: 8050
env:
- name: DATA_DIR
value: /app/src/data
- name: AG_GRID_LICENSE
valueFrom:
secretKeyRef:
name: ag-grid-credentials
key: ag-grid-license
- name: REDIS_MD_URI
valueFrom:
secretKeyRef:
name: mdrediscredentials
key: MDREDISCREDENTIALS
- name: PROTON_URL
valueFrom:
secretKeyRef:
name: proton-credentials
key: proton-url
- name: CLICKHOUSE_URL
valueFrom:
secretKeyRef:
name: clickhouse-credentials
key: clickhouse-url
- name: GOOGLE_SHEETS_CREDS
valueFrom:
secretKeyRef:
name: google-sheets-credentials
key: google-sheets-password
- name: GOOGLE_SHEETS_ID
valueFrom:
secretKeyRef:
name: google-sheets-credentials
key: google-sheets-id
- name: AWS_REGION
value: us-east-1
- name: AWS_DEFAULT_REGION
value: us-east-1
- name: HERMES_DATA_PATH
value: /app/src/data
resources:
requests:
cpu: 2
memory: 7Gi
limits:
cpu: 2
memory: 7Gi
tolerations:
- key: "<http://monoceros.io/large-memory-optimized|monoceros.io/large-memory-optimized>"
operator: "Equal"
value: "yes"
effect: "NoSchedule"
---
apiVersion: v1
kind: Service
metadata:
name: midas-gui-cluster-ip-service
spec:
type: ClusterIP
selector:
app: midas-gui
ports:
- protocol: TCP
port: 80
targetPort: 8050
---
apiVersion: v1
kind: Service
metadata:
name: midas-gui-load-balancer-service
annotations:
<http://service.beta.kubernetes.io/aws-load-balancer-type|service.beta.kubernetes.io/aws-load-balancer-type>: "nlb"
<http://service.beta.kubernetes.io/aws-load-balancer-scheme|service.beta.kubernetes.io/aws-load-balancer-scheme>: "internet-facing"
spec:
type: LoadBalancer
selector:
app: midas-gui
ports:
- protocol: TCP
port: 80
targetPort: 8050
---
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
name: midas-gui
annotations:
<http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target>: /
spec:
ingressClassName: nginx
rules:
- host: <http://midas.dev.orionintelligence.com|midas.dev.orionintelligence.com>
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: midas-gui-load-balancer-service
port:
number: 80
powerful-oxygen-51624
08/26/2024, 12:21 PMdeployment.yaml
and I do have container port there.powerful-oxygen-51624
08/27/2024, 12:45 PMbetter-van-82973
08/27/2024, 2:18 PMcareful-address-89803
09/02/2024, 1:33 AMkubectl port-forward
works, then the container is listening on that port and the container is built properly. You can also port-forward to the svc verify that the svc is forwarding correctly. The next thing to check is that your ingress can connect. You can check for any NetworkPolicies that prevent the nginx pods from contacting your svc. You can also check the logs of the ingress controller to see if it thinks it can connect.
You can also tell us the error you're getting beyond "cannot connect". That's not much to go on. Is it a HTTP 502? HTTP 504? timeout?