老师,你好,执行这个命令创建失败,麻烦您看下。
[root@master kubeimooc]# kubectl apply -f deployment.yaml
deployment.apps/kubeimooc created
[root@master kubeimooc]# kubectl get pod -n kubeimooc-system
No resources found in kubeimooc-system namespace.
[root@master kubeimooc]# kubectl get deployment -A
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system coredns 2/2 2 2 10d
kube-system nfs-subdir-external-provisioner 1/1 1 1 2d23h
kubeimooc-system kubeimooc 0/1 0 0 4m35s
metallb-system metallb-controller 1/1 1 1 2d22h
[root@master kubeimooc]# kubectl describe deployment -n kubeimooc-system
Name: kubeimooc
Namespace: kubeimooc-system
CreationTimestamp: Thu, 12 Oct 2023 19:55:58 +0800
Labels: app=kubeimooc
Annotations: deployment.kubernetes.io/revision: 1
Selector: app=kubeimooc
Replicas: 1 desired | 0 updated | 0 total | 0 available | 1 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: app=kubeimooc
Service Account: kubeimooc-admin
Containers:
server:
Image: harbor.kubeimooc.com/kubeimooc/kubeimooc:v1.5
Port: 8082/TCP
Host Port: 0/TCP
Environment: <none>
Mounts: <none>
web:
Image: harbor.kubeimooc.com/kubeimooc/kubeimooc-web:v1.0
Port: 80/TCP
Host Port: 0/TCP
Environment:
BACKEND_HOST: http://127.0.0.1:8082/
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Progressing True NewReplicaSetCreated
Available False MinimumReplicasUnavailable
ReplicaFailure True FailedCreate
OldReplicaSets: <none>
NewReplicaSet: kubeimooc-5f6f8c7f44 (0/1 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 5m19s deployment-controller Scaled up replica set kubeimooc-5f6f8c7f44 to 1
[root@master kubeimooc]# kubectl describe deployment -n kubeimooc-system
Name: kubeimooc
Namespace: kubeimooc-system
CreationTimestamp: Thu, 12 Oct 2023 19:55:58 +0800
Labels: app=kubeimooc
Annotations: deployment.kubernetes.io/revision: 1
Selector: app=kubeimooc
Replicas: 1 desired | 0 updated | 0 total | 0 available | 1 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: app=kubeimooc
Service Account: kubeimooc-admin
Containers:
server:
Image: harbor.kubeimooc.com/kubeimooc/kubeimooc:v1.5
Port: 8082/TCP
Host Port: 0/TCP
Environment: <none>
Mounts: <none>
web:
Image: harbor.kubeimooc.com/kubeimooc/kubeimooc-web:v1.0
Port: 80/TCP
Host Port: 0/TCP
Environment:
BACKEND_HOST: http://127.0.0.1:8082/
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Progressing True NewReplicaSetCreated
Available False MinimumReplicasUnavailable
ReplicaFailure True FailedCreate
OldReplicaSets: <none>
NewReplicaSet: kubeimooc-5f6f8c7f44 (0/1 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 5m26s deployment-controller Scaled up replica set kubeimooc-5f6f8c7f44 to 1
[root@master kubeimooc]# kubectl get deployment -A
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system coredns 2/2 2 2 10d
kube-system nfs-subdir-external-provisioner 1/1 1 1 2d23h
kubeimooc-system kubeimooc 0/1 0 0 5m32s
metallb-system metallb-controller 1/1 1 1 2d22h
[root@master kubeimooc]# kubectl get deployment -A
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system coredns 2/2 2 2 10d
kube-system nfs-subdir-external-provisioner 1/1 1 1 2d23h
kubeimooc-system kubeimooc 0/1 0 0 8m32s
metallb-system metallb-controller 1/1 1 1 2d22h
[root@master kubeimooc]# kubectl describe deployment -n kubeimooc-system
Name: kubeimooc
Namespace: kubeimooc-system
CreationTimestamp: Thu, 12 Oct 2023 19:55:58 +0800
Labels: app=kubeimooc
Annotations: deployment.kubernetes.io/revision: 1
Selector: app=kubeimooc
Replicas: 1 desired | 0 updated | 0 total | 0 available | 1 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: app=kubeimooc
Service Account: kubeimooc-admin
Containers:
server:
Image: harbor.kubeimooc.com/kubeimooc/kubeimooc:v1.5
Port: 8082/TCP
Host Port: 0/TCP
Environment: <none>
Mounts: <none>
web:
Image: harbor.kubeimooc.com/kubeimooc/kubeimooc-web:v1.0
Port: 80/TCP
Host Port: 0/TCP
Environment:
BACKEND_HOST: http://127.0.0.1:8082/
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Progressing True NewReplicaSetCreated
Available False MinimumReplicasUnavailable
ReplicaFailure True FailedCreate
OldReplicaSets: <none>
NewReplicaSet: kubeimooc-5f6f8c7f44 (0/1 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 8m37s deployment-controller Scaled up replica set kubeimooc-5f6f8c7f44 to 1
deployment.yaml文件内容是
apiVersion: apps/v1
kind: Deployment
metadata:
name: kubeimooc
namespace: kubeimooc-system
labels:
app: kubeimooc
spec:
selector:
matchLabels:
app: kubeimooc
template:
metadata:
labels:
app: kubeimooc
spec:
serviceAccount: kubeimooc-admin
imagePullSecrets:
- name: private-harbor-reg
containers:
- name: server
image: harbor.kubeimooc.com/kubeimooc/kubeimooc:v1.5
ports:
- name: port0
containerPort: 8082
- name: web
image: harbor.kubeimooc.com/kubeimooc/kubeimooc-web:v1.0
env:
- name: BACKEND_HOST
value: http://127.0.0.1:8082/
ports:
- name: port0
containerPort: 80