Skip to content

Kubernetes Setup

Franknaw edited this page Feb 2, 2021 · 2 revisions

Vagrant and Ansible configs


Managing the cluster

  • Bring cluster up.

    • vagrant up
  • Stop cluster.

    • vagrant halt
  • Destroy cluster

    • vagrant destroy
  • Connect to master node

    • vagrant ssh k8s-master
  • Connect to secondary nodes

    • vagrant ssh node-1
    • vagrant ssh node-2
  • Connect to master node and run some Kubernetes commands

    • kubectl get nodes
    • kubectl cluster-info
    • kubectl describe node node-1
  • List all services in the namespace

    • kubectl get services
  • List all pods in all namespaces

    • kubectl get pods --all-namespaces
  • List all pods in the current namespace, with more details

    • kubectl get pods -o wide
  • List a particular deployment

    • kubectl get deployment my-dep
  • List all pods in the namespace

    • kubectl get pods
  • Get a pod's YAML

    • kubectl get pod my-pod -o yaml
  • https://192.168.50.10:6443/api/v1/namespaces/kube-public/configmaps/cluster-info?timeout=10s

  • Get list of API's

    • kubectl api-resources -o wide
  • Get list of sub API's

for kind in `kubectl api-resources | tail +2 | awk '{ print $1 }' | sort`; do kubectl explain $kind ; done | grep -e "KIND:" -e  "VERSION:" | awk '{print $2}' | paste -sd' \n'

References