I have deleted my namespace. I check all the resources(i.e. pods,pvc,deployments,svc) are also deleted, however there is a loadbalancer services still under the deleted namespace. please find the details below :
kubectl get ns
NAME STATUS AGE
default Active 29d
kube-node-lease Active 29d
kube-public Active 29d
kube-system Active 29d
kured Active 28d
linkerd Active 24d
kubectl get svc -n z2a-prod
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
abcd-k8s-xyz LoadBalancer 10.0.16.244 10.0.0.168 9084:32747/TCP,9884:30595/TCP 2d22h
I did describe of loadbalancer service, found it is internal.
Annotations: service.beta.kubernetes.io/**azure-load-balancer-internal**: true
S
I tried to remove the finalizer from the loadbalancer:
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
creationTimestamp: "2021-02-02T17:23:06Z"
deletionGracePeriodSeconds: 0
deletionTimestamp: "2021-02-03T21:53:33Z"
finalizers:
- service.kubernetes.io/**load-balancer-cleanup**
and tried to save it. That doesnt work for me.
kubectl edit svc abcd-k8s-xyz -n z2a-prod
error: services "abcd-k8s-xyz" could not be found on the server
The edits you made on deleted resources have been saved to "/tmp/kubectl-edit-iizs9.yaml"
After above I tried to apply using the same tmp file, that also didnt work for me.
kubectl apply -f /tmp/kubectl-edit-iizs9.yaml
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
Error from server (NotFound): error when applying patch:
for: "/tmp/kubectl-edit-iizs9.yaml": namespaces "z2a-prod" not found
Please suggest what it going on here, why I am not able to delete this load balancer.
question from:https://stackoverflow.com/questions/66067108/azure-k8s-not-able-to-delete-load-balancer-service