• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

New User Failed Run Kubectl with Error “The connection to the server xxx.xxx.xxx was refused – did you specify the right host or port?”

by admin

The Problem

When run kubectl from a new created user, failed with error:

The connection to the server xxx.xxx.xxx was refused - did you specify the right host or port?

The Solution

A newly created user has no KUBECONFIG configured. Setup kubernetes configuration for the new user:

# mkdir -p $HOME/.kube
# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
# sudo chown $(id -u):$(id -g) $HOME/.kube/config

Filed Under: DevOps, Kubernetes

Some more articles you might also be interested in …

  1. How to use “break” and “continue” statements in shell scripts
  2. How to check the status and space used by images and containers
  3. Kubernetes Command Line Reference (Cheatsheet)
  4. How to resolve Docker Search Command Error – “getsockopt: no route to host” in CentOS / RHEL / Fedora
  5. How to backup and restore Docker containers
  6. Understanding “docker stats” Command Output
  7. Backtick (`) symbol in Linux Shell Scripting
  8. Korn Shell select Loop
  9. How to List / Search / Pull docker images on Linux
  10. How to Make a Variable read-only (constant) in Bash and Korn Shell

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright