I set up a local all-in-one Kubernetes env. I followed below steps to install. When I try to create my first RC, the RC created successfully, but the pod didn't get created:
Env: CentOS7
#systemctl disable firewalld
#systemctl stop firewalld
#yum install -y etcd kubernetes
#systemctl start etcd
#systemctl start docker
#systemctl start kube-apiserver
#systemctl start kube-controller-manager
#systemctl start kube-scheduler
#systemctl start kubelet
#systemctl start kube-proxy
All services started successful.
mysql-rc.yaml:
apiVersion: v1
kind: ReplicationController
metadata:
name: mysql
spec:
replicas: 1
selector:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 3306
env:
- name: MYSQL_ROOT_PASSWORD
value: "123456"
command:
[root@terryhu82 yaml]# kubectl create -f mysql-rc.yaml
replicationcontroller "mysql" created
[root@terryhu82 yaml]# kubectl get rc
NAME DESIRED CURRENT READY AGE
mysql 1 0 0 48s
[root@terryhu82 yaml]# kubectl get pods
No resources found.
[root@terryhu82 yaml]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@terryhu82 yaml]# kubectl get nodes
NAME STATUS AGE
127.0.0.1 Ready 23h
[root@terryhu82 yaml]# kubectl describe node 127.0.0.1
Name: 127.0.0.1
Role:
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/os=linux
kubernetes.io/hostname=127.0.0.1
Taints: <none>
CreationTimestamp: Mon, 06 Nov 2017 00:22:58 +0800
Phase:
Conditions:
Type Status LastHeartbeatTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
OutOfDisk False Mon, 06 Nov 2017 23:38:05 +0800 Mon, 06 Nov 2017 00:22:58 +0800 KubeletHasSufficientDisk kubelet has sufficient disk space available
MemoryPressure False Mon, 06 Nov 2017 23:38:05 +0800 Mon, 06 Nov 2017 00:22:58 +0800 KubeletHasSufficientMemory kubelet has sufficient memory available
DiskPressure False Mon, 06 Nov 2017 23:38:05 +0800 Mon, 06 Nov 2017 00:22:58 +0800 KubeletHasNoDiskPressure kubelet has no disk pressure
Ready True Mon, 06 Nov 2017 23:38:05 +0800 Mon, 06 Nov 2017 00:23:08 +0800 KubeletReady kubelet is posting ready status
Addresses: 127.0.0.1,127.0.0.1,127.0.0.1
Capacity:
alpha.kubernetes.io/nvidia-gpu: 0
cpu: 4
memory: 16416476Ki
pods: 110
Allocatable:
alpha.kubernetes.io/nvidia-gpu: 0
cpu: 4
memory: 16416476Ki
pods: 110
System Info:
Machine ID: 52ac3151ed7d485d98fa44e0da0e817b
System UUID: 564D434D-F7CF-9923-4B1D-A494E3391AE1
Boot ID: 148e293c-9631-4421-b55b-115ba72bc1d3
Kernel Version: 3.10.0-693.5.2.el7.x86_64
OS Image: CentOS Linux 7 (Core)
Operating System: linux
Architecture: amd64
Container Runtime Version: docker://1.12.6
Kubelet Version: v1.5.2
Kube-Proxy Version: v1.5.2
ExternalID: 127.0.0.1
Non-terminated Pods: (0 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits
--------- ---- ------------ ---------- --------------- -------------
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.
CPU Requests CPU Limits Memory Requests Memory Limits
------------ ---------- --------------- -------------
0 (0%) 0 (0%) 0 (0%) 0 (0%)
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
13m 13m 1 {kubelet 127.0.0.1} Normal Starting Starting kubelet.
13m 13m 1 {kubelet 127.0.0.1} Warning ImageGCFailed unable to find data for container /
13m 13m 6 {kubelet 127.0.0.1} Normal NodeHasSufficientDisk Node 127.0.0.1 status is now: NodeHasSufficientDisk
13m 13m 6 {kubelet 127.0.0.1} Normal NodeHasSufficientMemory Node 127.0.0.1 status is now: NodeHasSufficientMemory
13m 13m 6 {kubelet 127.0.0.1} Normal NodeHasNoDiskPressure Node 127.0.0.1 status is now: NodeHasNoDiskPressure
13m 13m 1 {kubelet 127.0.0.1} Warning Rebooted Node 127.0.0.1 has been rebooted, boot id: 148e293c-9631-4421-b55b-115ba72bc1d3
I didn't perform any configuration for the components. Can anyone help to guide me why the pods and container didn't get created? Where I can see the log?
to run this mysql you need 173MB
memory. you defined 128M as upper limit, thats why its not starting. you can use the below one.
apiVersion: v1
kind: ReplicationController
metadata:
name: mysql
spec:
replicas: 1
selector:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "200Mi"
cpu: "500m"
ports:
- containerPort: 3306
env:
- name: MYSQL_ROOT_PASSWORD
value: "123456"
htop output