kubectl get services
kubectl get svc kubectl get svc -A kubectl get svc -o json kubectl get svc -n monitoring
TYPE: ClusterIP, LoadBalancer, NodePort
kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 172.20.0.1 <none> 443/TCP 7d20h
kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE YOUR_SERVICE_NAME ClusterIP None <none> 1130/TCP 29h consul-dns ClusterIP 10.172.23.56 <none> 53/TCP,53UDP 29h
k get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 172.20.0.1 <none> 443/TCP 16d my-ingress-nginx-controller LoadBalancer 172.20.113.54 a2342354353456345ab-434234.us-east-1.elb.amazonaws.com 80:32520/TCP,443:31939/TCP 13m my-ingress-nginx-controller-admission ClusterIP 172.20.29.138 <none> 443/TCP 13m my-mariadb ClusterIP 172.20.157.59 <none> 3306/TCP 15d
kubectl -n nginx-ingress get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE nginx-ingress LoadBalancer 10.100.100.2 xxxx70yyyy.us-west-1.elb.amazonaws.com 80:31982/TCP,443:30529/TCP 8d
kubectl get svc --all-namespaces -o json | jq '.items[] | {name:.metadata.name, p:.spec.ports[] } | select( .p.nodePort != null ) | "\(.name): localhost:\(.p.nodePort) -> \(.p.port) -> \(.p.targetPort)"'
kubectl get service kube-dns -n kube-system NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kube-dns ClusterIP 10.100.0.10 <none> 53/UDP,53/TCP 3h52m
kubectl -n kube-system get endpoints kube-dns NAME ENDPOINTS AGE kube-dns <none> 3h55m
Contents
Minikube
kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 13m
kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE grafana ClusterIP 172.20.138.151 <none> 80/TCP 7m48s kubernetes ClusterIP 172.20.0.1 <none> 443/TCP 3d1h metrics-server ClusterIP 172.20.240.68 <none> 443/TCP 2m35s my-release-kubernetes-dashboard ClusterIP 172.20.100.126 <none> 443/TCP 22m
kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE hello-minikube NodePort 10.110.228.90 <none> 8080:32648/TCP 24h kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 25h my-release-ingress-nginx-controller LoadBalancer 10.106.155.20 <pending> 80:30629/TCP,443:31785/TCP 3m31s my-release-ingress-nginx-controller-admission ClusterIP 10.104.50.169 <none> 443/TCP 3m31s
After Installing Istio
kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE details ClusterIP 10.100.169.1 <none> 9080/TCP 3m55s hello-minikube NodePort 10.110.228.90 <none> 8080:32648/TCP 11d kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 11d my-release-ingress-nginx-controller LoadBalancer 10.106.155.20 <pending> 80:30629/TCP,443:31785/TCP 10d my-release-ingress-nginx-controller-admission ClusterIP 10.104.50.169 <none> 443/TCP 10d productpage ClusterIP 10.97.161.61 <none> 9080/TCP 3m54s ratings ClusterIP 10.106.29.228 <none> 9080/TCP 3m55s reviews ClusterIP 10.96.216.51 <none> 9080/TCP 3m55s
EKS
kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 172.20.0.1 <none> 443/TCP 14m
kubectl get services -A NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE default kubernetes ClusterIP 172.20.0.1 <none> 443/TCP 14m kube-system kube-dns ClusterIP 172.20.0.10 <none> 53/UDP, 53/TCP 14m
EKS after installing grafana:
kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE grafana ClusterIP 10.100.182.232 <none> 80/TCP 4m59s kubernetes ClusterIP 10.100.0.1 <none> 443/TCP 14h
EKS + metrics-server + kubernetes-dashboard
kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 172.20.0.1 <none> 443/TCP 44h metrics-server ClusterIP 172.20.94.132 <none> 443/TCP 26h my-release-kubernetes-dashboard ClusterIP 172.20.8.159 <none> 443/TCP 26h
kubectl get svc -n prod NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE your-app ClusterIP 10.100.125.208 <none> 443/TCP 44h cm-acme-http-solver-3kz7z NodePort 10.100.125.22 <none> 8089:32023/TCP 44h elasticsearch-master ClusterIP 10.100.67.254 <none> 9200/TCP,9300/TCP 6d22h elasticsearch-master-headless ClusterIP None <none> 9200/TCP,9300/TCP 6d22h your-api NodePort 10.100.3.113 <none> 80:30634/TCP 44h
Related terms
kubectl get apiservices
kubectl get services -n default
kubectl proxy
kind: Service
kubectl get endpoints -A
kubectl get ServiceAccount
kubectl get ingress
- kubectl describe services
See also
Advertising: