aloof-winter-17331
06/04/2024, 9:37 PMkubectl describe service/myservice
I see 6 endpoints, and unfortunately, Traefik dashboard confirms this under its "services" view. I can totally delete everything, even the api resources and then apply these manifests and the 6 endpoints will show up again.
Been spinning my wheels on this for a few days, not sure where to look or what to do. A colleague, who's more of a k8s admin wonders if it's some kind of bug in k3s, he didn't see anything wrong with my manifests or anything and recommended I post here.creamy-pencil-82913
06/04/2024, 9:56 PMcreamy-pencil-82913
06/04/2024, 9:56 PMaloof-winter-17331
06/04/2024, 9:56 PMcreamy-pencil-82913
06/04/2024, 9:57 PMcreamy-pencil-82913
06/04/2024, 9:57 PMkubectl get service -n NAMESPACE SERVICE -o yaml
and kubectl get endpoints -n NAMESPACE SERVICE -o yaml
aloof-winter-17331
06/04/2024, 9:59 PMcreamy-pencil-82913
06/04/2024, 9:59 PMcreamy-pencil-82913
06/04/2024, 9:59 PMaloof-winter-17331
06/04/2024, 10:00 PMcreamy-pencil-82913
06/04/2024, 10:00 PMaloof-winter-17331
06/04/2024, 10:00 PMaloof-winter-17331
06/04/2024, 10:06 PMapiVersion: v1
kind: Service
metadata:
annotations:
<http://kubectl.kubernetes.io/last-applied-configuration|kubectl.kubernetes.io/last-applied-configuration>: |
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"myapp","environment":"staging"},"name":"ui-service","namespace":"default"},"spec":{"ports":[{"name":"ui-port","port":8080,"targetPort":8080}],"selector":{"app":"myapp","environment":"staging"}}}
creationTimestamp: "2024-06-03T18:42:03Z"
labels:
app: myapp
environment: staging
name: ui-service
namespace: default
resourceVersion: "3620836"
uid: ffd69d15-24d2-4c6c-acc9-480381fab216
spec:
clusterIP: 10.43.19.167
clusterIPs:
- 10.43.19.167
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: ui-port
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: myapp
environment: staging
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
On the endpoints, I can already see IPs that are associated with other deployments being tied to this service for some reason. Those need to go away. I'll scrape that here in a sec.aloof-winter-17331
06/04/2024, 10:09 PMapiVersion: v1
kind: Endpoints
metadata:
creationTimestamp: "2024-06-04T17:48:23Z"
labels:
app: myapp
environment: staging
name: ui-service
namespace: default
resourceVersion: "3729444"
uid: 09617112-10cb-42cf-b466-444ed7b2e574
subsets:
- addresses:
- ip: 10.42.0.193
nodeName: cicd3
targetRef:
kind: Pod
name: ctrl-deployment-775f47748d-8v2z2
namespace: default
uid: ad46ea2c-1a7f-4e3f-8f23-ea1ed77143aa
- ip: 10.42.0.194
nodeName: cicd3
targetRef:
kind: Pod
name: logger-deployment-88c9877f9-qpn48
namespace: default
uid: 7382821e-7f63-4c76-926c-3664abbd58ce
- ip: 10.42.0.198
nodeName: cicd3
targetRef:
kind: Pod
name: postgres-deployment-7686575558-8h5ks
namespace: default
uid: 228c0c78-0cb8-4394-8922-2cb092e896db
- ip: 10.42.0.200
nodeName: cicd3
targetRef:
kind: Pod
name: cp-deployment-596dc55f85-wnv5v
namespace: default
uid: 9fee2059-ad8c-48f4-bfae-078f1d8abaff
- ip: 10.42.0.201
nodeName: cicd3
targetRef:
kind: Pod
name: ui-deployment-676c47cc97-vthmm
namespace: default
uid: 039049eb-4fd8-49d6-bc29-f3dfd0edf1d4
- ip: 10.42.0.202
nodeName: cicd3
targetRef:
kind: Pod
name: mb-deployment-5f645dc9cc-5r99q
namespace: default
uid: 3653ef44-f35d-4bbc-90f6-8daad1a0a52d
ports:
- name: ui-port
port: 8080
protocol: TCP
The only one that should relate to this service is the ui-deployment
if that's not obvious... but I'm not sure how these are getting or crossed between deployments.aloof-winter-17331
06/04/2024, 10:10 PMcreamy-pencil-82913
06/04/2024, 10:12 PMkubectl get pod -n default -l app=myapp,environment=staging
aloof-winter-17331
06/04/2024, 10:13 PMcreamy-pencil-82913
06/04/2024, 10:13 PMcreamy-pencil-82913
06/04/2024, 10:13 PMaloof-winter-17331
06/04/2024, 10:13 PMcreamy-pencil-82913
06/04/2024, 10:14 PMselector:
app: myapp
environment: staging
is where you tell it what labels to matchcreamy-pencil-82913
06/04/2024, 10:15 PMaloof-winter-17331
06/04/2024, 10:17 PMaloof-winter-17331
06/04/2024, 10:20 PMaloof-winter-17331
06/04/2024, 10:48 PM