What is the difference between "gcloud container clusters" and "kubectl" commands when using them to provision K8S cluster on GCP?
Asked Answered
P

1

8

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?

Ponder answered 2/11, 2019 at 18:2 Comment(0)
D
10

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:

Drysalt answered 2/11, 2019 at 19:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.