Problems encountered during Kubernetes cluster construction and Solutions
1. the following error is reported during Nginx Pod creation:
# Kubectlcreate-f nginx-pod.yaml
Error from server: error when creating "nginx-pod.yaml": Pod "nginx" is forbidden: no API token found for service account default/default, retry after the token is automatically created and added to the service account
Solution:
1> modify the KUBE_ADMISSION_CONTROL parameter in the/etc/kubernetes/apiserver file.
Before modification:
KUBE_ADMISSION_CONTROL = "-- admission_control = NamespaceLifecycle, NamespaceExists, LimitRanger, SecurityContextDeny, ServiceAccount, ResourceQuota"
Remove the "ServiceAccount" option.
2> restart the kube-apiserver service.
# Systemctl restart kube-apiserver.
2. An exception is displayed during Pod creation. The following error message is displayed when you view the log/var/log/messages:
Nov 26 21:52:06 localhost kube-apiserver: E1126 21:52:06. 697708 1963 server. go: 454] Unable to generate self signed cert: open/var/run/kubernetes/apiserver. crt: permission denied
Nov 26 21:52:06 localhost kube-apiserver: E1126 21:52:06. 697818 1963 server. go: 464] Unable to listen for secure (open/var/run/kubernetes/apiserver. crt: no such file or directory); will try again.
There are two solutions:
Method 1:
# Vim/usr/lib/systemd/system/kube-apiserver.service
[Service]
PermissionsStartOnly = true
ExecStartPre =-/usr/bin/mkdir/var/run/kubernetes
ExecStartPre =/usr/bin/chown-R kube: kube/var/run/kubernetes/
# Systemctl daemon-reload
# Systemctl restart kube-apiserver
Method 2:
# Vim/etc/kubernetes/apiserver
KUBE_API_ARGS = "-- secure-port = 0"
Add the -- secure-port = 0 parameter to KUBE_API_ARGS.
The reason is as follows:
-- Secure-port = 6443: The port on which to serve HTTPS with authentication and authorization. If 0, don't serve HTTPS at all.
3. When the Pod is created using the yaml file, the Error from server: the server cocould not find the requested resource is reported"
This problem is most difficult because the Kubernetes version is too low. Although the status of the node is Ready, the Pod cannot be created.
Adjoint phenomenon: when describing the node status, it is displayed as follows. Normally, there is no red box.
The displayed version information is as follows:
Note: This version information is consistent with the version information in the yum source officially provided by Kubernetes: http://cbs.centos.org/repos/virt7-testing/x86_64/ OS /Packages/
The latest version information is:
Kubelet Version: v1.0.3.34 + b9a88a7d0e357b
Cause:
The CentOS built-in CD is used as the local yum source, and the configuration file of the network yum source of CentOS is deleted.
Solution:
Use the configuration file of the network yum source that comes with CentOS.
PS: For how to build a Kubernetes cluster, refer to the official building guide.
Https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/getting-started-guides/centos/centos_manual_config.md
OpenStack, Kubernetes, and Mesos
For details about Kubernetes, click here
Kubernetes: click here
This article permanently updates the link address: