sfgroups
sfgroups

Reputation: 19109

How Kubectl command retrieves the manifest from remote server

When we run kubectl apply -k github.com/minio/direct-csi command, how kubectl downloads and apply the deployment manifest?

How can we download this file to local using curl or wget command?

Thanks SR

Upvotes: 1

Views: 494

Answers (1)

Jonas
Jonas

Reputation: 128827

You can see all the http request that kubectl does by using a verbose log level.

E.g.

kubectl get po --v=7

Output

$ kubectl get po --v=7
I0822 20:08:27.940422   36846 loader.go:375] Config loaded from file:  /Users/Jonas/.kube/config
I0822 20:08:27.958708   36846 round_trippers.go:420] GET https://clusteraddress.com/api/v1/namespaces/default/pods?limit=500
I0822 20:08:27.958736   36846 round_trippers.go:427] Request Headers:
I0822 20:08:27.958742   36846 round_trippers.go:431]     Accept: application/json;as=Table;v=v1beta1;g=meta.k8s.io, application/json
I0822 20:08:27.958747   36846 round_trippers.go:431]     User-Agent: kubectl/v1.17.5 (darwin/amd64) kubernetes/e0fccaf
I0822 20:08:28.624188   36846 round_trippers.go:446] Response Status: 200 OK in 665 milliseconds
NAME                  READY   STATUS    RESTARTS   AGE
nx-67b4f5946c-2z58x   1/1     Running   0          21h

How can we download this file to local using curl or wget command?

You can do the same with e.g. curl, everyting in Kubernetes is a REST API and you need proper authentication from your .kube/config or some else valid authentication.

what is download from github.com/minio/direct-cs ?

Instead of applying with kustomize (apply -k) you can just build the kustomize without applying with this command:

kubectl kustomize github.com/minio/direct-csi

And you should see all manifests (derived from kustomization.yaml) in the remote location in a large manifest.

Upvotes: 1

Related Questions