<p>I was trying to run 
"<code>kubectl get nodes</code>" command for k8s cluster.it gives "Unable to connect to the server: dial tcp..."
this is a k8s cluster created by a different user in the company AWS account.
this is the steps I have followed </p>

<pre><code>export AWS_PROFILE=RR
export KOPS_STATE_STORE=s3://s3bucketname 
kops export kubecfg dev.k8s.local
kubectl config get-contexts      

kubectl get nodes                                                                                                                                                              12:53:18 
Unable to connect to the server: dial tcp 3.136.226.173:443: i/o timeout       
</code></pre>

<p>I need to view running nodes and services in this k8 cluster how can I do this.</p>

<h2>Possible cause one: routing/firewall issues</h2>
<p>It happens when you create/use private cluster.</p>
<p>To solve - add an external <code>IP</code> to authorized networks.</p>
<p>to get your external <code>IP</code> address, you can use some of <a href="https://unix.stackexchange.com/a/81699/145897">these commands</a>:</p>
<pre><code>curl ifconfig.co
dig +short myip.opendns.com @resolver1.opendns.com

curl ifconfig.me
curl ifconfig.co
curl smart-ip.net/myip
wget -O - -q icanhazip.com
wget -O - -q ifconfig.me/ip

</code></pre>
<p>Other such resources:</p>
<ul>
<li><a href="http://ip.tyk.nu/" rel="nofollow noreferrer">http://ip.tyk.nu/</a></li>
<li><a href="http://whatismyip.akamai.com/" rel="nofollow noreferrer">http://whatismyip.akamai.com/</a></li>
<li><a href="http://tnx.nl/ip" rel="nofollow noreferrer">http://tnx.nl/ip</a></li>
<li><a href="http://ifcfg.me/" rel="nofollow noreferrer">http://ifcfg.me/</a></li>
<li><a href="http://l2.io/ip" rel="nofollow noreferrer">http://l2.io/ip</a></li>
<li><a href="http://ip.appspot.com/" rel="nofollow noreferrer">http://ip.appspot.com/</a></li>
<li><a href="http://ident.me/" rel="nofollow noreferrer">http://ident.me/</a></li>
<li><a href="http://ipof.in/txt" rel="nofollow noreferrer">http://ipof.in/txt</a></li>
<li><a href="http://icanhazip.com/" rel="nofollow noreferrer">http://icanhazip.com/</a></li>
<li><a href="http://curlmyip.com/" rel="nofollow noreferrer">http://curlmyip.com/</a></li>
<li><a href="http://wgetip.com/" rel="nofollow noreferrer">http://wgetip.com/</a></li>
<li><a href="http://curlmyip.com/" rel="nofollow noreferrer">http://curlmyip.com/</a></li>
<li><a href="http://bot.whatismyipaddress.com/" rel="nofollow noreferrer">http://bot.whatismyipaddress.com/</a></li>
<li><a href="http://eth0.me/" rel="nofollow noreferrer">http://eth0.me/</a></li>
<li><a href="http://ifconfig.me/" rel="nofollow noreferrer">http://ifconfig.me/</a></li>
<li><a href="http://corz.org/ip" rel="nofollow noreferrer">http://corz.org/ip</a></li>
<li><a href="http://ipecho.net/plain" rel="nofollow noreferrer">http://ipecho.net/plain</a></li>
</ul>
<h2>Possible cause two: lost/stale <code>k8s</code> context</h2>
<p>To get context use:</p>
<pre><code>kubectl config view 
</code></pre>
<p>To set context use:</p>
<pre><code>kubectl config set-context &lt;your_context&gt;
</code></pre>
<h2>Possible cause three: outdated CF template</h2>
<p>As per <a href="https://stackoverflow.com/a/54877219/5720818">this answer</a>, you'd check an <code>AMI</code> template that used when cluster was created.</p>
<blockquote>
<p>The cluster was set up using an older version of the CloudFormation template</p>
</blockquote>
