问题
I have one google compute instance in my project with an external IP. A describe command on the instance shows me:
networkInterfaces:
- accessConfigs:
- kind: compute#accessConfig
name: External NAT
natIP: xx.yyy.nnn.mmm
networkTier: PREMIUM
type: ONE_TO_ONE_NAT
fingerprint: hjhjhjhjh=
kind: compute#networkInterface
name: nic0
network: https://www.googleapis.com/compute/v1/projects/foo-201800/global/networks/default
However, when I run on the cloudshell.
$ gcloud config get-value project
Your active configuration is: [cloudshell-xxxx]
foo-201800
$ gcloud compute addresses list
Listed 0 items.
$ gcloud compute addresses list --global
Listed 0 items.
$ gcloud version
Google Cloud SDK 215.0.0
...snipped...
Are external ephemeral IP addresses not counted in the gcloud compute addresses
execution ?
回答1:
The ‘gcloud compute addresses’ command only counts static IP addresses assigned in a project. More specifically, you can read in the summary of the command the following description:
- 'gcloud compute addresses list': lists summary information of addresses in a project.
In the document about the compute engine IP addresses the definition about the static IP external address and the ephemeral IP address says the following:
Static external IP addresses are assigned to a project
Ephemeral external IP addresses are available to VM instances and forwarding rules.
The ephemeral IP are attached to a resources but not a project, when you use the command ‘gcloud compute addresses’ you are only listing the IP attached in a project; the static external IP.
Here you have an example to list the different types of IP address.
――
来源:https://stackoverflow.com/questions/52281989/gcloud-compute-addresses-list-returns-0-results-although-i-have-external-ephemer