I see 2 commands which can operate K8S cluster on GCP. One is gcloud container clusters
and the other is kubectl
.
Can anyone tell me what is the difference between them?
I see 2 commands which can operate K8S cluster on GCP. One is gcloud container clusters
and the other is kubectl
.
Can anyone tell me what is the difference between them?
The main difference is that the gcloud container clusters
command is primarily used for managing the allocation of resources for the cluster itself. E.g. it tells the Google Cloud Platform how to create, modify, and destroy the clusters supporting it. (Also important here are the gcloud container node-pools
and gcloud container operations
and gcloud container subnets
commands).
It also has a key command: gcloud container clusters get-credentials
which gives you the credentials you need to run the second command, kubectl
.
kubectl
, on the other hand, is the Kubernetes control command. It is used by all Kubernetes clusters, regardless of if they are on GCP, some other cloud provider, or manually set up on your own local hardware. It is primarily used for the manipulation of workloads (e.g. Pods, Deployments, StatefulSets, CronJobs etc) of the cluster itself, along with other configuration data (e.g. ConfigMaps, Secrets). It also allows for Kubernetes-native a administration of the cluster itself (e.g. granting cluster based roles to users, creating namespaces, etc).
Essentially, gcloud
gives you the ability to provision and deprovision resources, whereas kubectl
gives you the ability to use the clusters once provisioned.
More information:
gcloud container clusters
reference and GKE Documentation.kubectl
reference and overview© 2022 - 2024 — McMap. All rights reserved.