Kubernetes Fission setup fails - kubernetes

I am trying to install Fission on a Kubernetes Cluster. When I ran:
helm install --namespace fission https://github.com/fission/fission/releases/download/0.4.1/fission-all-0.4.1.tgz
I gave some errors:
E0218 09:14:41.578967 3357 portforward.go:331] an error occurred forwarding 36281 -> 44134: error forwarding port 44134 to pod b29ecdfb514ada5583e99e416d3fc07e25d5bcf71206b450a1f4f972a9d2502b, uid : exit status 1: 2018/02/18 09:14:41 socat[26057] E connect(5, AF=2 127.0.0.1:44134, 16): Connection refused
Error: transport is closing
How can I fix these errors and install Fission?
My Cluster OS is Debian 9 and Kubernetes version is:
kubeadm version: &version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.3", GitCommit:"", GitTreeState:"clean", BuildDate:"2018-02-07T11:55:20Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
Update:
I solved the previous error and i could install Fission. but i have a new error. When i ran fission env create --name nodejs --image fission/node-env:0.4.1
i gave this error:
Failed to create environment: Post
http://178.162.203.65:31313/v2/environments: dial tcp 178.162.203.65:31313:
getsockopt: connection refused

Finally I own found the answer of the question. When I was installing the Kubernetes. Exactly After ran kubeadm init I must ran :
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Neither root nor none-root must ran the above command.(I don't know why)

Related

Helm add repo fail with connection time out

I installed k3s using the following command. I'm using Vagrant box with opensuse.
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.19.5+k3s1 K3S_KUBECONFIG_MODE="644" sh -
It successfully installed.
kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.5+k3s1", GitCommit:"b11612e2744f39f01bfd208ff97315930c483667", GitTreeState:"clean", BuildDate:"2020-12-11T17:29:23Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.5+k3s1", GitCommit:"b11612e2744f39f01bfd208ff97315930c483667", GitTreeState:"clean", BuildDate:"2020-12-11T17:29:23Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
kubectl cluster-info
Kubernetes master is running at https://127.0.0.1:6443
CoreDNS is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
But when I run the following helm add repo command and the connection time out error message appears. I also export the kubeconfig file export KUBECONFIG=~/.kube/config.
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
Error: looks like "https://prometheus-community.github.io/helm-charts" is not a valid chart repository or cannot be reached: Get "https://prometheus-community.github.io/helm-charts/index.yaml": dial tcp 185.199.108.153:443: connect: connection timed out
When I run helm list command, the following message shows.
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
When I run helm list command, the following message is shown.
Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version?timeout=32s": dial tcp [::1]:8080: connect: connection refused
Any ideas for adding helm repo successfully to solve this issues. Thank in advance.

Kubernetes: /usr/local/bin/kubectl is version 1.19.0, and is incompatible with Kubernetes 1.16.2

I am setting up Kubernetes for the first on my local machine using Minikube.
I installed kubectl on my local machine using:
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
However, when I run the command:
minikube start
I get the following error:
πŸŽ‰ minikube 1.12.3 is available! Download it: https://github.com/kubernetes/minikube/releases/tag/v1.12.3
πŸ’‘ To disable this notice, run: 'minikube config set WantUpdateNotification false'
πŸ™„ minikube v1.5.2 on Ubuntu 18.04
πŸ’‘ Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.
πŸ”„ Starting existing virtualbox VM for "minikube" ...
βŒ› Waiting for the host to be provisioned ...
🐳 Preparing Kubernetes v1.16.2 on Docker '18.09.9' ...
πŸ”„ Relaunching Kubernetes using kubeadm ...
βŒ› Waiting for: apiserver
πŸ„ Done! kubectl is now configured to use "minikube"
⚠️ /usr/local/bin/kubectl is version 1.19.0, and is incompatible with Kubernetes 1.16.2. You will need to update /usr/local/bin/kubectl or use 'minikube kubectl' to connect with this cluster
I don't seem to understand what the error means by:
⚠️ /usr/local/bin/kubectl is version 1.19.0, and is incompatible with Kubernetes 1.16.2. You will need to update /usr/local/bin/kubectl or use 'minikube kubectl' to connect with this cluster
I can't remember installing minikube or Kubernetes before now on my local machine.
I finally figured it out what the issue was.
I ran the command kubectl version and I got the following output:
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0",
GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean",
BuildDate:"2020-08-26T14:30:33Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2",
GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean",
BuildDate:"2019-10-15T19:09:08Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
It showed me the date when I installed Kubernetes using minikube installer, which was sometime in 2019 when I was trying out Kubenetes initially.
Here's how I fixed it:
There are 2 solutions:
Solution 1
Uninstall older/previous versions of Kubernetes using minikube on the Linux machine:
minikube stop; minikube delete
docker stop (docker ps -aq)
rm -r ~/.kube ~/.minikube
sudo rm /usr/local/bin/localkube /usr/local/bin/minikube
systemctl stop '*kubelet*.mount'
sudo rm -rf /etc/kubernetes/
docker system prune -af --volumes
Or on Mac:
minikube stop; minikube delete &&
docker stop $(docker ps -aq) &&
rm -rf ~/.kube ~/.minikube &&
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube &&
launchctl stop '*kubelet*.mount' &&
launchctl stop localkube.service &&
launchctl disable localkube.service &&
sudo rm -rf /etc/kubernetes/ &&
docker system prune -af --volumes
Reinstall a new copy of minikube:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb
And then run the command below to pull a new base image of Kubernetes:
minkube start
This pulls a new image of Kubernetes, and also configures kubectl to use minikube.
Solution 2:
Run the command below to downgrade kubectl to the same version as Kubenetes on the local machine:
minikube kubectl
This will install the kubectl compatible version for Kubernetes using minikube
That's all.
I hope this helps
Installing kubectl again solved my issue.
In my case there was no need to uninstall older version I just followed installation steps again and it worked for me.
Update the apt package index and install packages needed to use the Kubernetes apt repository:
sudo apt-get update
sudo apt-get install -y ca-certificates curl
If you use Debian 9 (stretch) or earlier you would also need to install apt-transport-https:
sudo apt-get install -y apt-transport-https
Download the Google Cloud public signing key:
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
Add the Kubernetes apt repository:
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
Update apt package index with the new repository and install kubectl:
sudo apt-get update
sudo apt-get install -y kubectl
I Hope this works for you too

The connection to the server localhost:8080 was refused - did you specify the right host or port? FAQ

I am new to kubernetes . I got the below error while interacting with the cluster kubectl get nodes .
ERROR:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
After search in the internet i fixed my issues .
#sudo cp /etc/kubernetes/admin.conf $HOME/
#sudo chown $(id -u):$(id -g) $HOME/admin.conf
#export KUBECONFIG=$HOME/admin.conf
Your kubectl is probably not referring to right kubeconfig file or the kubeconfig file does not right details.
When there is clear instructions by kubeadm init to execute following commands as an regular user, if you miss runing them you end up with issue reported.
To make kubectl work for your non-root user, run these commands, which are also part of the kubeadm init output:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should check back the logs at kubeadm init time and you will find similar as below asking to execute the command.
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node
as root:
kubeadm join <control-plane-host>:<control-plane-port> --token <token> --discovery-token-ca-cert-hash sha256:<hash>
Maybe you not set environment variables, try this:
export KUBERNETES_MASTER=http://MasterIP:8080
MasterIP is your Kubernetes master IP
Issue is with the use-context in kubectl command.Please check the same in kubeconfig file.

KubeAdm fails to configure - Unable to connect to the server: EOF

I am getting issue to configure K8S running kubeadm on ubuntu 18.06.
After performing kubeadm-init on master 1 node all goes well :
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node
as root:
kubeadm join 172.40.0.10:6443 --token oormjp.gf43botx19purn13 --discovery-token-ca-cert-hash sha256:5e9c917221233fdae445640415fac123204f41d31d072cd06545055187c860e2
So I execute after following commands :
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
export KUBECONFIG=/etc/kubernetes/admin.conf
When I test kubeclt version, I get :
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.4", GitCommit:"c27b913fddd1a6c480c229191a087698aa92f0b1", GitTreeState:"clean", BuildDate:"2019-02-28T13:37:52Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
Unable to connect to the server: EOF
When I want to install a CNI such as weave or Flannel I get :
Unable to connect to the server: EOF
Here is my yaml config file use by kubeadm :
apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: stable
apiServer:
certSANs:
- "172.40.0.10"
controlPlaneEndpoint: "172.40.0.10:6443"
networking:
podSubnet: 10.244.0.0/16
172.40.0.10 : is a HAProxy server.
Can anyone help me to debug it?
using "flannel" pod network take a look for requirements and please run:
set /proc/sys/net/bridge/bridge-nf-call-iptables to 1 by running sysctl >net.bridge.bridge-nf-call-iptables=1 to pass bridged IPv4 traffic to iptables’
chains
You can find more information here.

Kubernetes - The connection to the server localhost:8080 was refused - did you specify the right host or port?

I just finished installing kubectl via Ubuntu 64 (Linux).
I followed the online Kubernetes guide, but I've had an error with the host. After the first step (install kubectl), when I checked the kubectl version, this was the message (I didn't yet install and deploy the minikube because I've not the connection according to this problem):
root#ubuntu:~# kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:39:04Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
Does someone have the same problem? How can I fix it?
The reason behind that is kubectl version prints Client Version and Server Version (kubernetes version) both. When you just install kubectl it is just Kubernetes client. If you have kubernetes cluster installed, it will print both kubectl version and kubernetes version.
If you want to just want to print client version, then use following command:
kubectl version --client=true
The error meant kubectl tried to contact the kubernetes server to get its version but couldn't connect. Are you specifying the right host or port to connect to the kubernetes server.
The reason behind the error is you have not installed kubernetes cluster on you mac. You just installed kubectl which is just a client to access kubernetes cluster. Once you install the kubernetes cluster the output of kubectl version will be like:
[root#ip-10-0-1-138 centos]# kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1",
GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:39:04Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:05:37Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
If you want to install the complete kubernetes cluster on mac, please try minikube to install cluster locally.
This happens when Kubectl command cannot find the config file inside the user's .kube folder. Here are the steps that you will need for your user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Or if you are the root user:
export KUBECONFIG=/etc/kubernetes/admin.conf