Home > Mobile >  kubectl patch returning service not found
kubectl patch returning service not found

Time:06-07

I have deployed pihole on my k3s cluster using this helm chart https://github.com/MoJo2600/pihole-kubernetes.
(I used this tutorial)
I now have my services but they dont have external IPs:

NAME             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
pihole-web       ClusterIP   10.43.58.197    <none>        80/TCP,443/TCP   11h
pihole-dns-udp   NodePort    10.43.248.252   <none>        53:30451/UDP     11h
pihole-dns-tcp   NodePort    10.43.248.144   <none>        53:32260/TCP     11h
pihole-dhcp      NodePort    10.43.96.49     <none>        67:30979/UDP     11h

I have tried to assing the IPs manually with this command:

kubectl patch svc pihole-dns-tcp -p '{"spec":{"externalIPs":["192.168.178.210"]}}'

But when executing the command i'm getting this error:

Error from server (NotFound): services "pihole-dns-tcp" not found

Any Ideas for a fix?
Thank you in advance :)

CodePudding user response:

  • Looks Like "pihole-dns-tcp" is in a different namespace to the namespace where patch command is being ran.

  • As per the article you have shared , it seems like service pihole-dns-tcp is in pihole . So the command should be

kubectl patch svc pihole-dns-tcp -n pihole -p '{"spec":{"externalIPs":["192.168.178.210"]}}'

  • Related