2 min read
When you create a Kubernetes Service, pods from within the same namespace should be able to resolve it's IP by name. For example, if we create a service named ampa-votacions; any pod from the same namespace should be able to resolve it's IP. But sometimes it can't be resolved:
$ kubectl exec -it ampa-install-ws7cw -- sh
/ $ nslookup ampa-votacions
Server: 172.20.0.10
Address: 172.20.0.10:53
** server can't find ampa-votacions.us-west-2.compute.internal: NXDOMAIN
** server can't find ampa-votacions.ampa.svc.cluster.local: NXDOMAIN
** server can't find ampa-votacions.svc.cluster.local: NXDOMAIN
** server can't find ampa-votacions.ampa.svc.cluster.local: NXDOMAIN
** server can't find ampa-votacions.cluster.local: NXDOMAIN
** server can't find ampa-votacions.svc.cluster.local: NXDOMAIN
** server can't find ampa-votacions.cluster.local: NXDOMAIN
** server can't find ampa-votacions.us-west-2.compute.internal: NXDOMAIN
19/04/2021
Read more...2 min read
To be able to expose a given Service externally, we can use NodePort as a quick-and-dirty way of achieving it. NodePort Services use a port on each Node to expose the Service outside of the cluster network
02/03/2021
Read more...2 min read
If we try to create a LoadBalancer on an AWS EKS cluster without any public subnet it will get stuck on the pending state and we won't get any external IP/DNS name for it. By using kubectl describe we will be able to get the actual error:
$ kubectl get svc -n pet2cattle
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
demo-lb LoadBalancer 172.20.235.213 <pending> 80:30525/TCP 7d
$ kubectl describe svc demo-lb -n pet2cattle
Name: demo-lb
Namespace: pet2cattle
Labels: <none>
Annotations: <none>
Selector: run=demo-lb
Type: LoadBalancer
IP Families: <none>
IP: 172.20.166.181
IPs: <none>
Port: <unset> 80/TCP
TargetPort: 80/TCP
NodePort: <unset> 30088/TCP
Endpoints: 10.236.124.69:80,10.236.126.253:80
Session Affinity: None
External Traffic Policy: Cluster
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal EnsuringLoadBalancer 12s (x3 over 27s) service-controller Ensuring load balancer
Warning SyncLoadBalancerFailed 12s (x3 over 27s) service-controller Error syncing load balancer: failed to ensure load balancer: could not find any suitable subnets for creating the ELB
17/02/2021
Read more...2 min read
One of kind of Service objects on kubernetes is extenalName. It creates a CNAME DNS entry to point to an external DNS service. For exemple:
kind: Service
apiVersion: v1
metadata:
name: ensvc
spec:
type: ExternalName
externalName: pet2cattle.com
29/01/2021
Read more...