Skip to content

Kubernetes: Services, DNS & networking checks

6 Kubernetes commands: Services, DNS & networking checks. Click a command to see what each part does.

Index
6 items
Click a command to see what each part does.

Services, DNS & networking checks6

  • kubectl describe svc <service> -n <namespace>Describe a service

    What each part does

    1. describe svctype, selector, ports, target ports, endpoints and events
    2. -n <namespace>in this namespace (default: the context's namespace; -A for all)
  • kubectl run dnstest --rm -it --restart=Never --image=busybox:1.36 -- nslookup <service>.<namespace>.svc.cluster.localTest DNS from inside the cluster

    What each part does

    1. kubectl run dnstest --rm -it --restart=Neverthrowaway pod, removed when done
    2. --image=busybox:1.36small image with nslookup
    3. <service>.<namespace>.svc.cluster.locala service's full DNS name
  • kubectl run curltest --rm -it --restart=Never --image=curlimages/curl -- curl -sv http://<service>.<namespace>:<port>/Call a service from inside the cluster

    What each part does

    1. --image=curlimages/curlimage with curl
    2. http://<service>.<namespace>:<port>/service DNS name and port: tests the path pods use
  • kubectl port-forward deploy/<deployment> <local-port>:<container-port> -n <namespace>Port-forward to a deployment or pod

    What each part does

    1. deploy/<deployment>picks one pod of the deployment (also pod/<pod>, svc/<service>)
    2. <local-port>:<container-port>localhost port : port in the pod
    3. -n <namespace>in this namespace (default: the context's namespace; -A for all)
  • kubectl proxy --port=8001Open a local proxy to the API server

    What each part does

    1. kubectl proxyauthenticated proxy: http://localhost:8001/api/... reaches the API, and services via /api/v1/namespaces/<ns>/services/<svc>/proxy/
    2. --port=8001local port
  • kubectl get --raw='/readyz?verbose'Check the API server health

    What each part does

    1. get --rawcall an API path directly
    2. /readyz?verboseeach readiness check with ok/failed (also /livez)

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…