kubernetes - "The connection to the server localhost:8080 was refused - did you specify the right host or port?" - Stack Overflow (https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196) (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (Stack Overflow) (/opensearch.xml) (https://stackoverflow.com/questions/72334044/the-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-r) (https://cdn.sstatic.net/Shared/stacks.css?v=d6a266655a25) (https://cdn.sstatic.net/Sites/stackoverflow/primary.css?v=22fb2cb11723) (Feed for question '"The connection to the server localhost:8080 was refused - did you specify the right host or port?"') (/feeds/question/72334044) (https://cdn.sstatic.net/Shared/Channels/channels.css?v=5981bb1a5bd7) (https://accounts.google.com/gsi/style) (site logo) Join Stack Overflow By clicking “Sign up”, you agree to our (/legal/terms-of-service/public) terms of service and acknowledge you have read our (/legal/privacy-policy) privacy policy . (80823973848d5aac2ae197737f179bc4b30ac67c67491815ce58aee3b012cf60) (1) (2.0) Sign up with Google Sign up with GitHub OR (80823973848d5aac2ae197737f179bc4b30ac67c67491815ce58aee3b012cf60) (1) () () () () () () Email Password (8+ characters (at least 1 letter & 1 number)) Sign up Already have an account? (/users/login) Log in (80823973848d5aac2ae197737f179bc4b30ac67c67491815ce58aee3b012cf60) () Skip to main content (https://stackoverflow.com) Stack Overflow (https://stackoverflow.co/) About Products (https://stackoverflow.co/teams/ai/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav-bar&utm_content=overflowai) OverflowAI (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=stack-overflow-for-teams) Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=stack-overflow-advertising) Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand (https://stackoverflow.co/teams/ai/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=overflow-ai) OverflowAI GenAI features for Teams (https://stackoverflow.co/api-solutions/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=overflow-api) OverflowAPI Train & fine-tune LLMs (https://stackoverflow.co/labs/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=labs) Labs The future of collective knowledge sharing (https://stackoverflow.co/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=about-the-company) About the company (https://stackoverflow.blog/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=blog) Visit the blog (Search…) () Loading… (https://stackoverflow.com) current community (https://stackoverflow.com) (Stack Overflow) Stack Overflow (https://stackoverflow.com/help) help (https://chat.stackoverflow.com/?tab=site&host=stackoverflow.com) chat (https://meta.stackoverflow.com) (Meta Stack Overflow) Meta Stack Overflow your communities (https://stackoverflow.com/users/signup?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f72334044%2fthe-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-r) Sign up or (https://stackoverflow.com/users/login?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f72334044%2fthe-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-r) log in to customize your list. (https://stackexchange.com/sites) more stack exchange communities (https://stackoverflow.blog) company blog (Click to show search) (https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f72334044%2fthe-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-r) Log in (https://stackoverflow.com/users/signup?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f72334044%2fthe-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-r) Sign up Let's set up your homepage Select a few topics you're interested in: python javascript c# reactjs java android html flutter c++ node.js typescript css r php angular next.js spring-boot machine-learning sql excel ios azure docker Or search from our full list: (Search) javascript python java c# php android html jquery c++ css ios sql mysql r reactjs node.js arrays c asp.net json python-3.x .net ruby-on-rails sql-server swift django angular objective-c excel pandas angularjs regex typescript ruby linux ajax iphone vba xml laravel spring asp.net-mvc database wordpress string flutter postgresql mongodb wpf windows amazon-web-services xcode bash git oracle-database spring-boot dataframe azure firebase list docker multithreading vb.net react-native eclipse algorithm powershell macos visual-studio numpy image forms scala function vue.js performance twitter-bootstrap selenium winforms kotlin loops express dart hibernate sqlite matlab python-2.7 shell rest apache entity-framework android-studio csv maven linq qt dictionary unit-testing asp.net-core facebook apache-spark tensorflow file swing class unity-game-engine sorting date authentication go symfony t-sql opencv matplotlib .htaccess google-chrome for-loop datetime codeigniter http perl validation sockets google-maps object uitableview xaml oop if-statement visual-studio-code cordova ubuntu web-services email android-layout github spring-mvc elasticsearch kubernetes selenium-webdriver ms-access user-interface parsing ggplot2 pointers google-sheets machine-learning c++11 security google-apps-script flask ruby-on-rails-3 templates nginx variables exception sql-server-2008 gradle debugging tkinter listview delphi jpa asynchronous web-scraping pdf haskell jsp ssl amazon-s3 google-cloud-platform jenkins testing xamarin wcf npm batch-file generics ionic-framework network-programming unix recursion google-app-engine mongoose visual-studio-2010 .net-core android-fragments assembly animation next.js math session svg hadoop intellij-idea curl django-models rust join winapi laravel-5 url heroku http-redirect tomcat google-cloud-firestore inheritance webpack keras image-processing gcc asp.net-mvc-4 logging dom swiftui web matrix pyspark actionscript-3 button post optimization firebase-realtime-database jquery-ui iis cocoa xpath d3.js javafx firefox internet-explorer xslt caching select asp.net-mvc-3 opengl events asp.net-web-api plot dplyr magento encryption search stored-procedures amazon-ec2 ruby-on-rails-4 memory audio canvas multidimensional-array jsf random vector cookies redux input facebook-graph-api flash xamarin.forms indexing arraylist ipad cocoa-touch data-structures video apache-kafka model-view-controller serialization jdbc woocommerce azure-devops routes razor awk servlets mod-rewrite beautifulsoup excel-formula docker-compose filter iframe aws-lambda design-patterns text django-rest-framework visual-c++ cakephp mobile android-intent react-hooks struct methods groovy mvvm ssh lambda checkbox ecmascript-6 google-chrome-extension time grails installation sharepoint cmake shiny spring-security jakarta-ee android-recyclerview plsql core-data types meteor android-activity sed bootstrap-4 websocket activerecord graph replace scikit-learn file-upload group-by vim junit boost deep-learning sass import memory-management error-handling async-await eloquent dynamic soap silverlight dependency-injection charts layout apache-spark-sql deployment browser gridview svn while-loop google-bigquery vuejs2 ffmpeg dll highcharts view foreach plugins makefile c#-4.0 redis reporting-services jupyter-notebook merge server unicode https reflection google-maps-api-3 twitter oauth-2.0 extjs pytorch axios terminal pip split cmd mysqli encoding django-views automation database-design collections hash netbeans build data-binding ember.js tcp sqlalchemy pdo apache-flex concurrency entity-framework-core command-line spring-data-jpa printing java-8 react-redux jestjs service html-table neo4j lua ansible material-ui parameters module enums flexbox visual-studio-2012 promise outlook firebase-authentication webview web-applications uwp jquery-mobile utf-8 datatable python-requests parallel-processing drop-down-menu colors scroll hive scipy tfs count syntax ms-word twitter-bootstrap-3 ssis google-analytics fonts three.js powerbi rxjs constructor graphql file-io paypal discord cassandra socket.io graphics compiler-errors gwt react-router nlp solr url-rewriting backbone.js memory-leaks datatables oauth terraform datagridview drupal oracle11g zend-framework neural-network knockout.js triggers django-forms interface google-api angular-material casting jmeter linked-list path proxy timer django-templates arduino orm directory parse-platform visual-studio-2015 windows-phone-7 cron push-notification conditional-statements primefaces functional-programming pagination model jar xamarin.android hyperlink uiview gitlab visual-studio-2013 vbscript google-cloud-functions azure-active-directory jwt download swift3 sql-server-2005 configuration process pygame rspec properties combobox callback windows-phone-8 linux-kernel safari permissions scrapy raspberry-pi scripting emacs clojure x86 scope io compilation expo mongodb-query responsive-design nhibernate angularjs-directive azure-functions request bluetooth dns 3d binding reference architecture discord.js playframework version-control pyqt doctrine-orm package get sql-server-2012 rubygems f# autocomplete openssl datepicker kendo-ui tree jackson controller yii pycharm nested grep xamarin.ios static dockerfile statistics null transactions datagrid active-directory uiviewcontroller webforms phpmyadmin discord.py notifications sas computer-vision duplicates mocking youtube nullpointerexception yaml menu sum bitmap blazor asp.net-mvc-5 electron visual-studio-2008 time-series yii2 jsf-2 css-selectors stl android-listview floating-point cryptography ant stream hashmap character-encoding msbuild sdk asp.net-core-mvc google-drive-api selenium-chromedriver jboss cors joomla navigation devise anaconda background camera multiprocessing pyqt5 binary cuda frontend linq-to-sql iterator mariadb onclick plotly ios7 rabbitmq android-jetpack-compose microsoft-graph-api android-asynctask tabs laravel-4 insert environment-variables uicollectionview amazon-dynamodb linker xsd console coldfusion upload continuous-integration ftp textview opengl-es vuejs3 operating-system mockito macros localization formatting xml-parsing json.net kivy type-conversion data.table timestamp calendar integer segmentation-fault android-ndk drag-and-drop prolog char crash jasmine automated-tests dependencies geometry android-gradle-plugin itext firebase-cloud-messaging header fortran sprite-kit mfc attributes nuxt.js azure-pipelines nosql format nestjs odoo db2 jquery-plugins jenkins-pipeline leaflet event-handling postman flutter-layout annotations julia keyboard textbox arm visual-studio-2017 gulp libgdx stripe-payments synchronization xampp timezone crystal-reports dom-events uikit azure-web-app-service android-emulator swagger wso2 sequelize.js namespaces aggregation-framework uiscrollview jvm google-sheets-formula chart.js com subprocess geolocation webdriver centos snowflake-cloud-data-platform html5-canvas garbage-collection dialog widget numbers concatenation qml sql-update set tuples windows-10 java-stream mapreduce smtp ionic2 rotation modal-dialog spring-data android-edittext http-headers nuget doctrine radio-button sonarqube grid lucene xmlhttprequest internationalization listbox initialization switch-statement components google-play apache-camel boolean serial-port ldap ios5 youtube-api gdb return latex pivot eclipse-plugin frameworks tags containers github-actions dataset asp-classic subquery label foreign-keys c++17 copy uinavigationcontroller delegates google-cloud-storage migration struts2 base64 protractor embedded find queue sql-server-2008-r2 uibutton arguments composer-php append jaxb zip stack cucumber autolayout ide entity-framework-6 popup tailwind-css iteration airflow r-markdown windows-7 ssl-certificate vb6 gmail hover jqgrid g++ udp range Next You’ll be prompted to create an account to view your personalized homepage. (/) Home (/questions) Questions (/tags) Tags (/beta/discussions) Discussions Labs (https://chat.stackoverflow.com/?tab=all&sort=active) Chat (/users) Users (/jobs?source=so-left-nav) Jobs (https://stackoverflow.com/jobs/companies?so_medium=stackoverflow&so_source=SiteNav) Companies Collectives Communities for your favorite technologies. (/collectives-all) Explore all Collectives Teams () Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflowteams.com/teams/create/free/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Try Teams for free (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Explore Teams Teams Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams-compact) Explore Teams Collectives™ on Stack Overflow Find centralized, trusted content and collaborate around the technologies you use most. (/collectives) Learn more about Collectives Teams Q&A for work Connect and share knowledge within a single location that is structured and easy to search. (https://stackoverflow.co/teams/) Learn more about Teams (Illustration of upvote icon after it is clicked) Hang on, you can't upvote just yet. You'll need to complete a few actions and gain 15 reputation points before being able to upvote. Upvoting indicates when questions and answers are useful. (https://stackoverflow.com/help/whats-reputation) What's reputation and how do I get it? Instead, you can save this post to reference later. Save this post for later Not now (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (/questions/72334044/the-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-r) "The connection to the server localhost:8080 was refused - did you specify the right host or port?" (/questions/ask) Ask Question (2022-05-22 00:27:44Z) Asked 2 years, 11 months ago Modified (?lastactivity) (2025-01-20 04:01:19Z) 2 months ago (Viewed 129,270 times) Viewed 129k times Part of (/collectives/aws) AWS Collective This question shows research effort; it is useful and clear (70:3:31e,16:ebe3b8549d7b04dc,10:1744936035,16:45c2cef3680c8282,8:72334044,7a33eab382eb47cbea24d0757f718e449efcf44df2a4df57938a3185863b245f) 24 (This question does not show any research effort; it is unclear or not useful) (70:3:31e,16:1bb8f13c5f9ce6d0,10:1744936035,16:36147e5caad6dcb5,8:72334044,7726f9ff155e775baa2d1fa2fab0eccd0265b90bd948026d663ce8e07756aab1) Save this question. (/posts/72334044/timeline) Show activity on this post. I'm on an ec2 instance trying to get my cluster created. I have kubectl already installed and here are my services and workloads yaml files services.yaml apiVersion: v1 kind: Service metadata: name: stockapi-webapp spec: selector: app: stockapi ports: - name: http port: 80 type: LoadBalancer workloads.yaml apiVersion: v1 kind: Deployment metadata: name: stockapi spec: selector: matchLabels: app: stockapi replicas: 1 template: # template for the pods metadata: labels: app: stockapi spec: containers: - name: stock-api image: public.ecr.aws/u1c1h9j4/stock-api:latest When I try to run kubectl apply -f workloads.yaml I get this as an error The connection to the server localhost:8080 was refused - did you specify the right host or port? I also tried changing the port in my services.yaml to 8080 and that didn't fix it either (/collectives/aws) AWS Collective (/questions/tagged/kubernetes) (show questions tagged 'kubernetes') kubernetes (/questions/tagged/amazon-eks) (show questions tagged 'amazon-eks') amazon-eks (/q/72334044) (Short permalink to this question) Share Share a link to this question Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/72334044/edit) () Improve this question Follow (70:3:31e,16:ffd4d1b36ecfa988,10:1744936035,16:3e0ecc5629869cfc,8:72334044,cfde7f79048dcc9241bbb4c4125c158475f97a31a2a60ccd405b3368d432bc0a) Follow this question to receive notifications asked (2022-05-22 00:27:44Z) May 22, 2022 at 0:27 (/users/18238338/mp32) (MP32's user avatar) (/users/18238338/mp32) MP32 MP32 (reputation score) 721 (3 gold badges) 3 3 gold badges (15 silver badges) 15 15 silver badges (33 bronze badges) 33 33 bronze badges (Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.) Add a comment | (Expand to show all comments on this post) 8 Answers 8 Sorted by: (/questions/72334044/the-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-r?answertab=scoredesc#tab-top) Reset to default (scoredesc) Highest score (default) (trending) Trending (recent votes count more) (modifieddesc) Date modified (newest first) (createdasc) Date created (oldest first) This answer is useful (70:3:31e,16:c71141a93f23c8ff,10:1744936035,16:882a70b31e9a4750,8:72334192,985d3c64c38a4409112691e17bf2432d7defbf18e72ce1aa93f747c16b651e1e) 31 (This answer is not useful) (70:3:31e,16:3eea85138faf19f2,10:1744936035,16:1049b6925e732213,8:72334192,96312e100f7675882079b05220cacff1bb41685c54ab91536deac5a4aa5212a1) Save this answer. (Loading when this answer was accepted…) (/posts/72334192/timeline) Show activity on this post. This error comes when you don't have ~/.kube/config file present or configured correctly on the client / where you run the kubectl command. kubectl reads the clusterinfo and which port to connect to from the ~/.kube/config file. if you are using eks here's how you can create config file (https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html) aws eks create kubeconfig file (/a/72334192) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/72334192/edit) () Improve this answer Follow (70:3:31e,16:370a0845e8de8eeb,10:1744936035,16:755bbb79a81e4d58,8:72334192,cab3ccfa1e8def38dba2c399d518482479f869dcf198916183c054c1ef9f1301) Follow this answer to receive notifications answered (2022-05-22 01:16:42Z) May 22, 2022 at 1:16 (/users/8056267/preet-sindhal) (Preet Sindhal's user avatar) (/users/8056267/preet-sindhal) Preet Sindhal Preet Sindhal (reputation score) 599 (5 silver badges) 5 5 silver badges (7 bronze badges) 7 7 bronze badges 3 (number of 'useful comment' votes received) 1 The path to the kube config file can be read/set via the variable $KUBECONFIG FWIW. – (/users/3597730/ruby-newbie) (3,295 reputation) ruby_newbie Commented (2023-10-03 15:49:41Z, License: CC BY-SA 4.0) Oct 3, 2023 at 15:49 (number of 'useful comment' votes received) 1 what about azure? – (/users/1542624/yawar) (1,943 reputation) Yawar Commented (2023-10-17 09:37:11Z, License: CC BY-SA 4.0) Oct 17, 2023 at 9:37 (number of 'useful comment' votes received) 2 If someone using minikube make sure to start minikube using this command minikube start – (/users/14457833/ankit-tiwari) (4,725 reputation) Ankit Tiwari Commented (2024-01-25 09:47:09Z, License: CC BY-SA 4.0) Jan 25, 2024 at 9:47 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:4f9e1b85ddcef0a9,10:1744936035,16:740ada69e44e12d4,8:73634290,3d9298d9f245546a6d0a313b31a354372bd2ad120751a330afcbc466acfc11af) 6 (This answer is not useful) (70:3:31e,16:e05821c0c065ec4a,10:1744936035,16:535fbe382b040fcf,8:73634290,a02479c7b77e3e382911255f80060199d7ebe1157c2b9014628d3bebaa8fb67c) Save this answer. (Loading when this answer was accepted…) (/posts/73634290/timeline) Show activity on this post. In my case I had a problem with a certificate authority. Found out that by checking the kubectl config kubectl config view The clusters part was null, instead of having something similar to - cluster: certificate-authority-data: DATA+OMITTED server: https://kubernetes.docker.internal:6443 name: docker-desktop It was not parsed because of time differences between my machine and a server (several seconds was enough). Running sudo apt-get install ntp sudo apt-get install ntpdate sudo ntpdate ntp.ubuntu.com Had solved the issue. (/a/73634290) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/73634290/edit) () Improve this answer Follow (70:3:31e,16:0edab867c2fcc877,10:1744936035,16:c60eb8d42036753d,8:73634290,c103ebe4d51b351419830bbb268d3072f5083ef2640c1e21179a830dcc271a04) Follow this answer to receive notifications answered (2022-09-07 10:56:22Z) Sep 7, 2022 at 10:56 (/users/4475588/igor-tiulkanov) (Igor Tiulkanov's user avatar) (/users/4475588/igor-tiulkanov) Igor Tiulkanov Igor Tiulkanov (reputation score) 596 (8 silver badges) 8 8 silver badges (19 bronze badges) 19 19 bronze badges 1 (number of 'useful comment' votes received) 5 Although my problem differed, kubectl config view is an excellent debugging step. – (/users/9496212/iuooip) (91 reputation) iuooip Commented (2023-03-01 12:43:36Z, License: CC BY-SA 4.0) Mar 1, 2023 at 12:43 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:7dd8abc2253f30f6,10:1744936035,16:343675a055f65eb3,8:75255326,f9906a1edf4a3fc39984856b9db224bac308c488c0db3700829fa5b8fb8bda36) 4 (This answer is not useful) (70:3:31e,16:2b7c96a1d9634ee4,10:1744936035,16:ae0242095fed5c77,8:75255326,8c864ad35d826fbfcb29d59fa4b78c9de775fc725374a3b962489e78941282d0) Save this answer. (Loading when this answer was accepted…) (/posts/75255326/timeline) Show activity on this post. Encountered the exact error in my cluster when I executed the "kubectl get nodes" command. The connection to the server localhost:8080 was refused - did you specify the right host or port? I ran the following command in master node and it fixed the error. apt-get update && apt-get install -y apt-transport-https ca-certificates curl software-properties-common curl -fsSL (https://download.docker.com/linux/ubuntu/gpg) https://download.docker.com/linux/ubuntu/gpg | apt-key add - add-apt-repository "deb [arch=amd64] (https://download.docker.com/linux/ubuntu) https://download.docker.com/linux/ubuntu focal stable" apt-get update && apt-get install -y containerd.io Configure containerd mkdir -p /etc/containerd containerd config default > /etc/containerd/config.toml systemctl restart containerd (/a/75255326) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/75255326/edit) () Improve this answer Follow (70:3:31e,16:138b741134dafac5,10:1744936035,16:8ddc8d7f23080fab,8:75255326,41c4c5e8113a422045b6ece276c370b2f83b687b15bc4162cd9b16fb2ad1b792) Follow this answer to receive notifications answered (2023-01-27 07:56:37Z) Jan 27, 2023 at 7:56 (/users/11403167/lherben-g) (Lherben G's user avatar) (/users/11403167/lherben-g) Lherben G Lherben G (reputation score) 393 (2 silver badges) 2 2 silver badges (6 bronze badges) 6 6 bronze badges (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:cb62cc2d22e0de21,10:1744936035,16:2252e48643e8b1fa,8:73438969,90ac4fa5d969d4f2f178a8bd120373fbbe77d6a2ef3b82b9a40baa4439cbd783) 0 (This answer is not useful) (70:3:31e,16:5cbdf44c233c6005,10:1744936035,16:cfc6358ea0346709,8:73438969,d74c7cb8cab7e81f7fb3880915c58eecdff1bf3d92d5a027fe07e3c36a68dc55) Save this answer. (Loading when this answer was accepted…) (/posts/73438969/timeline) Show activity on this post. I was following the instructions on (https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html) aws With me, I was on a Mac. I had docker desktop installed. This seemed to include kubectl in homebrew I traced it down to a link in usr/local/bin and renamed it to kubectl-old Then I reinstalled kubectl, put it on my path and everything worked. I know this is very specific to my case, but may help others. (/a/73438969) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/73438969/edit) () Improve this answer Follow (70:3:31e,16:2298cb88ef0c648b,10:1744936035,16:3ac3aab73d2f489a,8:73438969,be0aef752fd3e7f5442c59f09cf07753c2883c6a534726e9ca0d929d9a644928) Follow this answer to receive notifications answered (2022-08-21 23:42:17Z) Aug 21, 2022 at 23:42 (/users/5082504/jake) (Jake's user avatar) (/users/5082504/jake) Jake Jake (reputation score) 4,680 (10 gold badges) 10 10 gold badges (43 silver badges) 43 43 silver badges (89 bronze badges) 89 89 bronze badges 1 That's exactly what i did on my Mac too, or you can just open Docker GUI on Mac or Window before you use kubectl . You could check API server with docker ps | grep kube-apiserver – (/users/1386405/aung-baw) (456 reputation) Aung Baw Commented (2023-05-11 03:19:25Z, License: CC BY-SA 4.0) May 11, 2023 at 3:19 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:b88584246a11e95a,10:1744936035,16:d23cb19ec7517cc1,8:77663218,bc6a912bacac72fc1fb22978cd68fcf84dba1867fea6769c064d418d0135538e) 0 (This answer is not useful) (70:3:31e,16:10e70861cbcf5090,10:1744936035,16:3c484798cddec755,8:77663218,10728a762100dd9b2e17816dc33ff7a4cab123c0ff4c7e39eb01e26acd08396f) Save this answer. (Loading when this answer was accepted…) (/posts/77663218/timeline) Show activity on this post. ERROR: The connection to the server localhost:8080 was refused - did you specify the right host or port? In my case, issue was fixed by exporting the KUBECONFIG export KUBECONFIG=/home/.kube/kubeconfig (/a/77663218) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/77663218/edit) () Improve this answer Follow (70:3:31e,16:109526446827e787,10:1744936035,16:92831b8dd9529968,8:77663218,19c2a791753334f3751c0a5ca991faa81a6ff3642dc763be1a05c439e47ba9f2) Follow this answer to receive notifications answered (2023-12-14 21:44:36Z) Dec 14, 2023 at 21:44 (/users/11059124/jagadeeshk) (JagadeeshK's user avatar) (/users/11059124/jagadeeshk) JagadeeshK JagadeeshK (reputation score) 47 (7 bronze badges) 7 7 bronze badges (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:e67e0fe7198daaaf,10:1744936035,16:9c3d0743539bfbe1,8:79370245,a4c0da61f0948c1b7b20b5ae84e82d668e1de1562771bcf61b6e86ce4a9e5447) 0 (This answer is not useful) (70:3:31e,16:002b904639a0e9ca,10:1744936035,16:c0cfceae71238c0a,8:79370245,814fdf183646163b3a5c322777ef5839b67b556e7ecc1875a63c0c24d9ad9dc8) Save this answer. (Loading when this answer was accepted…) (/posts/79370245/timeline) Show activity on this post. I was using ansible trying to install calico and discovered I had placed some extra arguments in the playbook command. I took the extra args out and ran it like this and it finally worked: ansible-playbook -i inventory/inventory.yml --limit "control-1" --ask-become-pass -u XXXX kubernetes_install_part2_network.yml (/a/79370245) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/79370245/edit) () Improve this answer Follow (70:3:31e,16:0a87e6d739000c12,10:1744936035,16:e12417e12b8010d8,8:79370245,ac02a9cbd1947cd902c9a5e047a9f0d1a6079aea679965e39764de85e03b4684) Follow this answer to receive notifications answered (2025-01-20 04:01:19Z) Jan 20 at 4:01 (/users/9919968/texasdave) (texasdave's user avatar) (/users/9919968/texasdave) texasdave texasdave (reputation score) 756 (1 gold badge) 1 1 gold badge (5 silver badges) 5 5 silver badges (16 bronze badges) 16 16 bronze badges (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:693148e033644ffd,10:1744936035,16:925df743e50d1a11,8:73472703,e056df733e26063e2a633702daeb55cfd53c414bb4dfbcaf85be1303c20a630c) -1 (This answer is not useful) (70:3:31e,16:afdb16812a052f27,10:1744936035,16:b2ac1861fe034c57,8:73472703,52c814baff957e0dadb6241f78bae0af68c471886ca30de954851e667b4cc88f) Save this answer. (Loading when this answer was accepted…) (/posts/73472703/timeline) Show activity on this post. I found how to solve this question. Run the below commands 1.sudo -i 2.swapoff -a 3.exit 4.strace -eopenat kubectl version and you can type kubectl get nodes again. Cheers ! (/a/73472703) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/73472703/edit) () Improve this answer Follow (70:3:31e,16:fda704dfcd1a03c6,10:1744936035,16:212eb717f1217ff9,8:73472703,d591b42ecac4de4b0fc43888c0eece017984e6a5bf5bdb77a80dca411b2fb49e) Follow this answer to receive notifications answered (2022-08-24 11:55:49Z) Aug 24, 2022 at 11:55 (/users/19837382/techhari) (TechHari's user avatar) (/users/19837382/techhari) TechHari TechHari (reputation score) 1 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:7df61eadf910d7c1,10:1744936035,16:5969c653eb8a2049,8:74736388,17830d4c34893e086249da4e9192ddf3fb9c6e2fd9eb1fe78ed761dd9b153328) -1 (This answer is not useful) (70:3:31e,16:4d430cc20dc3dba5,10:1744936035,16:10b70f26b08745bd,8:74736388,9f8dd0bc6ed2d3adccf3787f2d6b02d8fcd84514e2b4a38009c67a1c8fe29718) Save this answer. (Loading when this answer was accepted…) (/posts/74736388/timeline) Show activity on this post. I got the same error and after switching from root user to regular user (ubuntu, etc...) my problem was fixed. (/a/74736388) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/74736388/edit) () Improve this answer Follow (70:3:31e,16:a84bdd78457b0ae9,10:1744936035,16:c0f7036033a21417,8:74736388,6d1d08f8abda3569750db66f3affc116eb6f48a1bc96afdc6a5719b3d5a938ab) Follow this answer to receive notifications (/posts/74736388/revisions) (show all edits to this post) edited (2022-12-08 21:14:37Z) Dec 8, 2022 at 21:14 answered (2022-12-08 21:12:58Z) Dec 8, 2022 at 21:12 user18547346user18547346 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) (/help/privileges/protect-questions) Highly active question . Earn 10 reputation (not counting the (https://meta.stackexchange.com/questions/141648/what-is-the-association-bonus-and-how-does-it-work) association bonus ) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity. Start asking to get answers Find the answer to your question by asking. (/questions/ask) Ask question Explore related questions (/questions/tagged/kubernetes) (show questions tagged 'kubernetes') kubernetes (/questions/tagged/amazon-eks) (show questions tagged 'amazon-eks') amazon-eks See similar questions with these tags. (/collectives/aws/beta/discussions) AWS Collective Join the discussion (/collectives) This question is in a collective: a subcommunity defined by tags with relevant content and experts. The Overflow Blog (https://stackoverflow.blog/2025/04/16/wbit-7-exploring-webassembly-with-the-first-so-user-to-get-10k-rep/?cb=1) WBIT #7: Exploring WebAssembly with the first SO user to get 10k rep (https://stackoverflow.blog/2025/04/17/wait-what-is-agentic-ai/?cb=1) Wait, what is agentic AI? Featured on Meta (Meta Stack Exchange) (https://meta.stackexchange.com/questions/407927/changes-to-reporting-for-the-status-review-escalation-process?cb=1) Changes to reporting for the [status-review] escalation process (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/421831/policy-generative-ai-e-g-chatgpt-is-banned?cb=1) Policy: Generative AI (e.g., ChatGPT) is banned (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/433466/a-discussion-about-closed-and-potentially-useful-posts-on-stack-overflow?cb=1) A discussion about closed (and potentially useful) posts on Stack Overflow Related (https://stackoverflow.com/q/39004557?rq=3) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/39004557/connection-refused-with-kubectl-on-ec2-ubuntu-instance?rq=3) Connection refused with kubectl on EC2 ubuntu instance? (https://stackoverflow.com/q/51121136?rq=3) (Question score (upvotes - downvotes)) 32 (https://stackoverflow.com/questions/51121136/the-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-ri?rq=3) The connection to the server localhost:8080 was refused - did you specify the right host or port? (https://stackoverflow.com/q/54071343?rq=3) (Question score (upvotes - downvotes)) 13 (https://stackoverflow.com/questions/54071343/kubernetes-the-connection-to-the-server-localhost8080-was-refused-did-you-s?rq=3) Kubernetes - The connection to the server localhost:8080 was refused - did you specify the right host or port? (https://stackoverflow.com/q/56115398?rq=3) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/56115398/kubernetes-cluster-on-aws-the-connection-to-the-server-localhost8080-was-refuse?rq=3) Kubernetes cluster on AWS,The connection to the server localhost:8080 was refused (https://stackoverflow.com/q/60056043?rq=3) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/60056043/the-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-ri?rq=3) The connection to the server localhost:8080 was refused - did you specify the right host or port? FAQ (https://stackoverflow.com/q/63218597?rq=3) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/63218597/dial-tcp-127-0-0-18080-connect-connection-refused-aws-codebuild-eks?rq=3) dial tcp 127.0.0.1:8080: connect: connection refused AWS CodeBuild EKS (https://stackoverflow.com/q/65688449?rq=3) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/65688449/connecting-to-a-kubernetes-service-resulted-in-connection-refused?rq=3) Connecting to a Kubernetes service resulted in connection refused (https://stackoverflow.com/q/70145472?rq=3) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/70145472/getting-connection-refused-while-trying-to-access-service-from-kubernetes-pod?rq=3) Getting Connection refused while trying to access service from kubernetes pod (https://stackoverflow.com/q/72117876?rq=3) (Question score (upvotes - downvotes)) 8 (https://stackoverflow.com/questions/72117876/unable-to-connect-to-aws-eks-cluster?rq=3) Unable to connect to AWS EKS cluster (https://stackoverflow.com/q/72333897?rq=3) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/72333897/accessing-an-endpoint-in-a-kubernetes-pod-but-get-connection-error?rq=3) Accessing an Endpoint in a Kubernetes Pod but get connection error (https://stackexchange.com/questions?tab=hot) Hot Network Questions (Software Engineering Stack Exchange) (https://softwareengineering.stackexchange.com/questions/457135/why-should-i-never-ever-ever-use-java-serialization) Why should I never ever ever use Java serialization? (Philosophy Stack Exchange) (https://philosophy.stackexchange.com/questions/124292/in-an-infinite-universe-can-certain-events-be-more-likely-than-others) In an infinite universe, can certain events be "more likely" than others? (English Language & Usage Stack Exchange) (https://english.stackexchange.com/questions/630912/why-does-though-seem-to-require-re-establishing-the-subject-but-and-does-no) Why does "though" seem to require re-establishing the subject, but "and" does not? (Super User) (https://superuser.com/questions/1892272/discord-thinks-i-am-living-in-the-future-why) Discord thinks I am living in the future - why? (Physics Stack Exchange) (https://physics.stackexchange.com/questions/847850/what-does-newtons-laws-say-about-the-geometry-of-spacetime) What does Newton's laws say about the geometry of spacetime? (Mathematics Stack Exchange) (https://math.stackexchange.com/questions/5056493/what-explains-this-peak-probability-gain-in-the-birthday-problem) What explains this peak probability "gain" in the birthday problem? (Science Fiction & Fantasy Stack Exchange) (https://scifi.stackexchange.com/questions/296052/is-morpheus-saying-that-neo-can-simply-choose-to-not-die-from-anything-at-all-in) Is Morpheus saying that Neo can simply choose to not die from anything at all in the Matrix? (Physics Stack Exchange) (https://physics.stackexchange.com/questions/847893/why-didnt-earth-bounce-upon-collision-during-the-formation-of-moon) Why didn't Earth bounce upon collision during the formation of moon? (Bicycles Stack Exchange) (https://bicycles.stackexchange.com/questions/96581/how-has-this-inner-tube-perished) How has this inner tube perished? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/740974/tagged-pdf-float-here-h) Tagged PDF & float here [H] (Server Fault) (https://serverfault.com/questions/1179145/how-to-get-dell-idrac-ip-from-linux) How to get DELL iDRAC IP from Linux? (Super User) (https://superuser.com/questions/1892383/my-pst-file-on-laptop-is-too-big-to-backup-online-what-can-i-do) My pst file on laptop is too big to backup online. What can I do? (Chess Stack Exchange) (https://chess.stackexchange.com/questions/46891/puzzles-on-chess-com-mate-or-material) Puzzles on Chess.com - mate or material (Physics Stack Exchange) (https://physics.stackexchange.com/questions/847797/rotational-work-and-energy) Rotational Work and Energy (Arqade) (https://gaming.stackexchange.com/questions/411879/what-changes-between-loops-in-outer-wilds) What changes between loops in Outer Wilds? (Blender Stack Exchange) (https://blender.stackexchange.com/questions/333630/make-instance-real-multiplies-the-original-mesh-instead-of-the-instances-i-want) Make instance real multiplies the original mesh instead of the instances I want in my points on faces (Worldbuilding Stack Exchange) (https://worldbuilding.stackexchange.com/questions/265939/can-opposite-chirality-organisms-coexist-on-a-klein-bottle-world-without-unstopp) Can opposite-chirality organisms coexist on a Klein bottle world without unstoppable disease? (Physics Stack Exchange) (https://physics.stackexchange.com/questions/847857/andromeda-relativity-days-apart-really) Andromeda Relativity - Days Apart Really? (Puzzling Stack Exchange) (https://puzzling.stackexchange.com/questions/131493/%cf%80thagoras-cycloid-angle) πthagoras cycloid angle (Puzzling Stack Exchange) (https://puzzling.stackexchange.com/questions/131505/riddle-written-on-10-stones) Riddle Written on 10 Stones (Travel Stack Exchange) (https://travel.stackexchange.com/questions/194956/scams-for-russian-girls-wanting-to-travel-to-united-states) Scams for Russian girls wanting to travel to united States (Worldbuilding Stack Exchange) (https://worldbuilding.stackexchange.com/questions/265928/ancient-preservative-method-for-animal-fur-and-skin-to-help-as-artifact-display) ancient preservative method for animal fur and skin to help as artifact display? (Science Fiction & Fantasy Stack Exchange) (https://scifi.stackexchange.com/questions/296078/worlds-finest-boy-thunders-inspiration) World's Finest: Boy Thunder's inspiration (Travel Stack Exchange) (https://travel.stackexchange.com/questions/194948/methods-tools-to-evaluate-public-transportation-convenience-from-one-hotel-to) Methods & tools to evaluate public transportation convenience from one hotel to another (/feeds/question/72334044) (Feed of this question and its answers) Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader. (https://stackoverflow.com/feeds/question/72334044) () lang-yaml (https://stackoverflow.com) (https://stackoverflow.com) Stack Overflow (/questions) Questions (/help) Help (https://chat.stackoverflow.com/?tab=site&host=stackoverflow.com) Chat (https://stackoverflow.co/) Products (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=teams) Teams (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=advertising) Advertising (https://stackoverflow.co/advertising/employer-branding/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=talent) Talent (https://stackoverflow.co/) Company (https://stackoverflow.co/) About (https://stackoverflow.co/company/press/) Press (https://stackoverflow.co/company/work-here/) Work Here (https://stackoverflow.com/legal) Legal (https://stackoverflow.com/legal/privacy-policy) Privacy Policy (https://stackoverflow.com/legal/terms-of-service/public) Terms of Service (/contact) Contact Us Your Privacy Choices (https://stackoverflow.com/legal/cookie-policy) Cookie Policy (https://stackexchange.com) Stack Exchange Network (https://stackexchange.com/sites#technology) Technology (https://stackexchange.com/sites#culturerecreation) Culture & recreation (https://stackexchange.com/sites#lifearts) Life & arts (https://stackexchange.com/sites#science) Science (https://stackexchange.com/sites#professional) Professional (https://stackexchange.com/sites#business) Business (https://api.stackexchange.com/) API (https://data.stackexchange.com/) Data (https://stackoverflow.blog?blb=1) Blog (https://www.facebook.com/officialstackoverflow/) Facebook (https://twitter.com/stackoverflow) Twitter (https://linkedin.com/company/stack-overflow) LinkedIn (https://www.instagram.com/thestackoverflow) Instagram Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under (https://stackoverflow.com/help/licensing) CC BY-SA . rev 2025.4.17.25340