When Kubernetes creates a pod based on yaml, 8080 access is denied and an error is reported.

I learned about Kubernetes for the first time and did a little test about Kubernetes according to the authoritative guide of Kubernetes

related environment is:

centos7 64-bit

Kubernetes 1.5.2

docker 1.13.1

etcd 3.2.22

etcd,Kubernetes,docker is installed, and then the firewall and selinux are turned off.

status of firewall:

[root@localhost kubernetes]-sharp systemctl status iptables.service
iptables.service-IPv4 firewall with iptables Loaded: loaded
(/ usr/lib/systemd/system/iptables.service; disabled; vendor preset:
disabled) Active: inactive (dead) since five 2018-08-10 16:05:50
CST; 32min ago Process: 13907
ExecStop=/usr/libexec/iptables/iptables.init stop (code=exited,
status=0/SUCCESS) Process: 12874
ExecStart=/usr/libexec/iptables/iptables.init start (code=exited,
status=0/SUCCESS) Main PID: 12874 (code=exited, status=0/SUCCESS)

August 10 16:05:50 localhost.localdomain systemd [1]: Stopping IPv4
firewall with iptables. August 10 16:05:50 localhost.localdomain
iptables.init [13907]: iptables: Setting chains to policy. ] August 10
16:05:50 localhost.localdomain iptables.init [13907]: iptables:
Flushing firewall rules:. ] August 10 16:05:50 localhost.localdomain
iptables.init [13907]: iptables: Unloading modules: [OK] August 10
16:05:50 localhost.localdomain systemd [1]: Stopped IPv4 firewall with
iptables. Warning: Journal has been rotated since unit was started.
Log output is incomplete or unavailable. Hint: Some lines were
ellipsized, use-l to show in full.

status of selinux:

[root@localhost kubernetes]-sharp getenforce
Disabled

wrote about the yaml file (which is an excerpt from the book)

started the following services:

systemctl start docker

systemctl start kube-apiserver
systemctl start kube-controller-manager
systemctl start kube-scheduler
systemctl start kubelet
systemctl start kube-proxy

View service:

[root@localhost kubernetes]-sharp ps-ef | grep kube kube 14403
10 16:29? 00:00:00 / usr/bin/kube-controller-manager
-- logtostderr=true-- vault 0-- master= http://127.0.0.1:8080 kube 14416 1 1 16:29? 00:00:00 / usr/bin / kube-scheduler
-- logtostderr=true-- http://127.0.0.1" 0-- master= http://127.0.0.1:8080 root 14427 1 3 16:29? 00:00:00 / usr/bin/kubelet
-- logtostderr=true-- VIP 0-- api-servers= http://127.0.0.1 : 8080-- address=127.0.0.1-- hostname-override=127.0.0.1-- allow-privileged=false-- pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest
root 14477 1 3 16:29? 00:00:00 / usr/bin/kube-proxy
-- logtostderr=true-- vault 0-- master= http://127.0.0.1:8080

then create pod:

kubectl create-f / root/yaml/mysql-rc.yaml

confidence in reporting errors is as follows:

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

View port 8080:

netstat-an | grep 8080 does not have any information

check the relevant information on the Internet, and modify the following two points:

1) it is said to modify the listening address, and all modifications are as follows:

./apiserver:-sharpKUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
./config:-sharpKUBE_MASTER="--master=http://0.0.0.0:8080"
./kubelet:-sharpKUBELET_ADDRESS="--address=0.0.0.0"
./kubelet:-sharpKUBELET_API_SERVER="--api-servers=http://0.0.0.0:8080"

and then restart:

systemctl restart kube-apiserver
systemctl restart kube-controller-manager
systemctl restart kube-scheduler
systemctl restart kubelet
systemctl restart kube-proxy

View service:

[root@localhost kubernetes]-sharp ps -ef | grep kube
kube   14403   1 0 16:29 ?    00:00:00 /usr/bin/kube-controller-manager --logtostderr=true --v=0 --master=http://0.0.0.0:8080
kube   14416   1 1 16:29 ?    00:00:00 /usr/bin/kube-scheduler --logtostderr=true --v=0 --master=http://0.0.0.0:8080
root   14427   1 3 16:29 ?    00:00:00 /usr/bin/kubelet --logtostderr=true --v=0 --api-servers=http://0.0.0.0:8080 --address=0.0.0.0 --hostname-override=127.0.0.1 --allow-privileged=false --pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest
root   14477   1 3 16:29 ?    00:00:00 /usr/bin/kube-proxy --logtostderr=true --v=0 --master=http://0.0.0.0:8080
View port 8080:

[root@localhost kubernetes]-sharp netstat-anltp | grep 8080
[root@localhost kubernetes]-sharp

Why is it in service, and why is the port not listening?

2) modify the KUBE_ADMISSION_CONTROL in the apiserver file to remove the ServiceAccount

KUBE_ADMISSION_CONTROL= "--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota"

restart:

systemctl restart kube-apiserver

according to the above modification, an error is reported:

[root@localhost kubernetes]-sharp kubectl create-f / root/yaml/mysql-rc.yaml
The connection to the server localhost:8080 was refused-did you specify the right host or port?

to sum up all the questions:

1. Why is there no way to create a pod,? why is the port rejected?

2. The services are up. Why is the port not being monitored?

ask the great gods to help me and see what"s wrong with this. Thank you!

Apr.07,2021
The

platform is large, but everyone is a passer-by. My heart is a little cold.
the cause of the problem has been found by myself. This is due to the fact that the etcd service is not enabled, which can be seen through the message log information. Yesterday, we did not notice that the kube-apiserver service was not started, because there was no error echo when starting systemctl start kube-apiserver. I ignored it by myself, and I have to read the diary in the future.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e45eee-44b6c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e45eee-44b6c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?