<p>It seems that the only way to create node pools on Google Kubernetes Engine is with the command <code>gcloud container node-pools create</code>. I would like to have all the configuration in a YAML file instead. What I tried is the following:</p>

<pre><code>apiVersion: v1
kind: NodeConfig
metadata:
  annotations:
    cloud.google.com/gke-nodepool: ares-pool
spec:
  diskSizeGb: 30
  diskType: pd-standard
  imageType: COS
  machineType: n1-standard-1
  metadata:
    disable-legacy-endpoints: 'true'
  oauthScopes:
  - https://www.googleapis.com/auth/devstorage.read_only
  - https://www.googleapis.com/auth/logging.write
  - https://www.googleapis.com/auth/monitoring
  - https://www.googleapis.com/auth/service.management.readonly
  - https://www.googleapis.com/auth/servicecontrol
  - https://www.googleapis.com/auth/trace.append
  serviceAccount: default
</code></pre>

<p>But <code>kubectl apply</code> fails with:</p>

<pre><code>error: unable to recognize "ares-pool.yaml": no matches for kind "NodeConfig" in version "v1"
</code></pre>

<p>I am surprised that Google yields almost no relevant results for all my searches. The only documentation that I found was the one on Google Cloud, which is quite incomplete in my opinion.</p>

rubik
<p>Node pools are not Kubernetes objects, they are part of the Google Cloud API. Therefore Kubernetes does not know about them, and kubectl apply will not work. </p>

<p>What you actually need is a solution called <em>"infrastructure as code"</em> - a code that will tell GCP what kind of node pool it wants. </p>

<p>If you don't strictly need YAML, you can check out Terraform that handles this use case. See: <a href="https://terraform.io/docs/providers/google/r/container_node_pool.html" rel="nofollow noreferrer">https://terraform.io/docs/providers/google/r/container_node_pool.html</a> </p>

<p>You can also look into <em>Google Deployment Manager</em> or <em>Ansible</em> (it has GCP module, and uses YAML syntax), they also address your need.</p>
