Api Groups
- We interact with the
kube api-server, either through thekubectlutility or REST APIs. - Can find the API version by running a
curlcommand with the following:curl https://kube-master:6443/version - To get a list of pods, we perform this command:
curl https://kube-master:6443/api/v1/pods - API has many groups:
/metrics,/healthz,/version,/api,/apis,/logs /metricsand/healthz- monitor the health of the cluster.- Focus on the cluster’s functionality.
- There are two categories of API’s,
coreandnamedgroups:- core -
/api - named -
/apis
- core -
- The core group is where the main functionality of Kubernetes lies:
/v1–>namespaces,pods,rc,events,endpoints,nodes,bindings,PV,PVC (Persistent Volume Claims),configmaps,secretsandservices
- The named groups are more organised.
/apisyou have the following:/apps–>/v1–>/deployments,/replicasetsand/statefulsets
/extensions/networking.k8s.io–>/v1–>/networkpolicies
/storage.k8s.io/authentication.k8s.io/certificates.k8s.io–>/v1–>/certificatesigningrequests- The main ones such as
/apps,/extensions,networking.k8s.ioare API Groups. - The ones at the bottom such as
/deployments,/replicasets,/statefulsetsare Resources. - Each resource has an action associated. For example under
/deployments:listgetcreatedeleteupdatewatch
- All of the above are called Verbs.
- Can also list the available API groups with the following command:
curl http://localhost:6443 -k - Running a
grepfornamereturns all of the supported resource groups:curl http://localhost:6443/apis -k | grep "name" - Must authenticate to the API by passing in your certificate files:
curl http://localhost:6443 -k --key admin.key --cert admin.crt --cacert ca.crt - Another option is to start a
kubectl proxyclient. Runkubectl proxyto start the service. - Run the command and it starts a service on port
8001.- The flow from the proxy is like so:
kubectl proxy–>kube apiserver- It uses credentials and certificates from the user’s kubeconfig file.
- Can then successfully run
curl http://localhost:6443 -k
- Can then successfully run
- It uses credentials and certificates from the user’s kubeconfig file.
- The flow from the proxy is like so:
- Kube proxy is not the same as
kubectl proxy - Kube proxy allows connectivity between different pods and nodes in the cluster.
kubectl proxy–> HTTP proxy service created by the kubectl utility to access the kube-apiserver.