- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在按照 kubernetes 官方文档中的说明使用 mysql 创建一个简单的有状态应用程序,但它确实对我有用,我想知道你们中是否有人可以在两分钟内在他自己的 GCP 上测试它,看看是否我是唯一一个有问题的人,这个例子不起作用:
https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/
这些是文档中的文件:
应用程序/mysql/mysql-deployment.yaml
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
ports:
- port: 3306
selector:
app: mysql
clusterIP: None
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: mysql
spec:
selector:
matchLabels:
app: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql
spec:
containers:
- image: mysql:5.6
name: mysql
env:
# Use secret in real usage
- name: MYSQL_ROOT_PASSWORD
value: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
应用程序/mysql/mysql-pv.yaml
kind: PersistentVolume
apiVersion: v1
metadata:
name: mysql-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
注意:我做了几次尝试,因此 pod 名称可能会有所不同......
看起来一切正常,但我遇到了 CrashLoopBackOff:
xxx@cloudshell:~ (academic-veld-230622)$ gcloud container clusters get-credentials standard-cluster-1 --zone us-central1-a --project academic-veld-230622
Fetching cluster endpoint and auth data.
kubeconfig entry generated for standard-cluster-1.
xx@cloudshell:~ (academic-veld-230622)$ kubectl apply -f https://k8s.io/examples/application/mysql/mysql-pv.yaml
persistentvolume/mysql-pv-volume created
persistentvolumeclaim/mysql-pv-claim created
xxx@cloudshell:~ (academic-veld-230622)$ kubectl apply -f https://k8s.io/examples/application/mysql/mysql-deployment.yaml
service/mysql created
deployment.apps/mysql created
@cloudshell:~ (academic-veld-230622)$ kubectl describe deployment mysql
Name: mysql
Namespace: default
CreationTimestamp: Thu, 11 Apr 2019 18:46:58 +0200
Labels: <none>
Annotations: deployment.kubernetes.io/revision=1
kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"mysql","namespace":"default"},"spec":{"selector":{"matchLabels":{"app"...
Selector: app=mysql
Replicas: 1 desired | 1 updated | 1 total | 0 available | 1 unavailable
StrategyType: Recreate
MinReadySeconds: 0
Pod Template:
Labels: app=mysql
Containers:
mysql:
Image: mysql:5.6
Port: 3306/TCP
Host Port: 0/TCP
Environment:
MYSQL_ROOT_PASSWORD: password
Mounts:
/var/lib/mysql from mysql-persistent-storage (rw)
Volumes:
mysql-persistent-storage:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: mysql-pv-claim
ReadOnly: false
Conditions:
Type Status Reason
---- ------ ------
Available False MinimumReplicasUnavailable
Progressing True ReplicaSetUpdated
OldReplicaSets: <none>
NewReplicaSet: mysql-fb75876c6 (1/1 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 34s deployment-controller Scaled up replica set mysql-fb75876c6 to 1
xxxx@cloudshell:~ (academic-veld-230622)$ kubectl get pods -l app=mysql
NAME READY STATUS RESTARTS AGE
mysql-fb75876c6-522j9 0/1 RunContainerError 4 1m
xxx@cloudshell:~ (academic-veld-230622)$ kubectl get pods -l app=mysql
NAME READY STATUS RESTARTS AGE
mysql-fb75876c6-522j9 0/1 CrashLoopBackOff 6 7m
@cloudshell:~ (academic-veld-230622)$ kubectl describe pvc mysql-pv-claim
Name: mysql-pv-claim
Namespace: default
StorageClass: manual
Status: Bound
Volume: mysql-pv-volume
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"name":"mysql-pv-claim","namespace":"default"},"spec":{"accessModes":["R...
pv.kubernetes.io/bind-completed=yes
pv.kubernetes.io/bound-by-controller=yes
Finalizers: [kubernetes.io/pvc-protection]
Capacity: 20Gi
Access Modes: RWO
Events: <none>
在更大的机器上记录第二次尝试:
@cloudshell:~ (academic-veld-230622)$ kubectl logs mysql-fb75876c6-ctchn --previous
failed to open log file "/var/log/pods/68c34d6f-5c7d-11e9-9029-42010a800043/mysql/5.log": open /var/log/pods/68c34d6f-5c7d-11e9-9029-42010a800043/mysql/5.log: no such file or directorymasuareza@cloudshell:~ (academic-veld-230622)$
Going into the console:
https://console.cloud.google.com/logs/viewer?interval=NO_LIMIT&project=academic-veld-230622&authuser=0&minLogLevel=0&expandAll=false×tamp=2019-04-11T17%3A25%3A37.805000000Z&customFacets&limitCustomFacetWidth=true&advancedFilter=resource.type%3D%22k8s_cluster%22%0Aresource.labels.project_id%3D%22academic-veld-230622%22%0Aresource.labels.cluster_name%3D%22standard-cluster-1%22%0Aresource.labels.location%3D%22us-central1-a%22%0Atimestamp%3D%222019-04-11T17%3A15%3A30.999350000Z%22%0AinsertId%3D%22d99409fb-66f8-4eab-8066-6c8b976aaec8%22&scrollTimestamp=2019-04-11T17%3A15%3A30.999350000Z
第三次尝试:
Showing logs from all time (CEST)
No older entries found matching current filter.
2019-04-11 19:39:54.278 CEST
k8s.io
create
default:mysql-fb75876c6-r42x6:mysql-fb75876c6-r42x6
system:kube-scheduler
{"@type":"type.googleapis.com/google.cloud.audit.AuditLog","authenticationInfo":{"principalEmail":"system:kube-scheduler"},"authorizationInfo":[{"granted":true,"permission":"io.k8s.core.v1.pods.binding.create","resource":"core/v1/namespaces/default/pods/mysql-fb75876c6-r42x6/binding/mysql-fb75876c6-…
Expand all | Collapse all {
insertId: "39605b90-16dd-470b-996f-b072fb262595"
labels: {…}
logName: "projects/academic-veld-230622/logs/cloudaudit.googleapis.com%2Factivity"
operation: {…}
protoPayload: {…}
receiveTimestamp: "2019-04-11T17:40:22.506801591Z"
resource: {…}
timestamp: "2019-04-11T17:39:54.278100Z"
}
DESCRIBE POD:
@cloudshell:~ (academic-veld-230622)$ kubectl describe pod mysql-fb75876c6-r42x6
Name: mysql-fb75876c6-r42x6
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: gke-standard-cluster-1-default-pool-119c7a9c-5jp1/10.150.0.15
Start Time: Thu, 11 Apr 2019 19:39:54 +0200
Labels: app=mysql
pod-template-hash=963143272
Annotations: kubernetes.io/limit-ranger=LimitRanger plugin set: cpu request for container mysql
Status: Running
IP: 10.48.0.13
Controlled By: ReplicaSet/mysql-fb75876c6
Containers:
mysql:
Container ID: docker://63fbbebe5d246f56299b0194ed34ca3614349db1ab96251e23d098b0efbcac4b
Image: mysql:5.6
Image ID: docker-pullable://mysql@sha256:5ab881bc5abe2ac734d9fb53d76d984cc04031159152ab42edcabbd377cc0859
Port: 3306/TCP
Host Port: 0/TCP
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: ContainerCannotRun
Message: error while creating mount source path '/mnt/data': mkdir /mnt/data: read-only file system
Exit Code: 128
Started: Thu, 11 Apr 2019 19:45:40 +0200
Finished: Thu, 11 Apr 2019 19:45:40 +0200
Ready: False
Restart Count: 6
Requests:
cpu: 100m
Environment:
MYSQL_ROOT_PASSWORD: password
Mounts:
/var/lib/mysql from mysql-persistent-storage (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-rrhql (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
mysql-persistent-storage:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: mysql-pv-claim
ReadOnly: false
default-token-rrhql:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-rrhql
Optional: false
QoS Class: Burstable
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 10m default-scheduler Successfully assigned default/mysql-fb75876c6-r42x6 to gke-standard-cluster-1-default-pool-119c7a9c-5jp1
Normal Pulling 10m kubelet, gke-standard-cluster-1-default-pool-119c7a9c-5jp1 pulling image "mysql:5.6"
Normal Pulled 10m kubelet, gke-standard-cluster-1-default-pool-119c7a9c-5jp1 Successfully pulled image "mysql:5.6"
Normal Created 9m (x5 over 10m) kubelet, gke-standard-cluster-1-default-pool-119c7a9c-5jp1 Created container
Warning Failed 9m (x5 over 10m) kubelet, gke-standard-cluster-1-default-pool-119c7a9c-5jp1 Error: failed to start container "mysql": Error response from daemon: error while creating mount source path '/mnt/data': mkdir /mnt/data: read-only file system
Normal Pulled 9m (x4 over 10m) kubelet, gke-standard-cluster-1-default-pool-119c7a9c-5jp1 Container image "mysql:5.6" already present on machine
Warning BackOff 46s (x43 over 10m) kubelet, gke-standard-cluster-1-default-pool-119c7a9c-5jp1 Back-off restarting failed container
failed to start container "6562e2c146ecf2087d438141550e385a1abf83de8ef1dd7a6fdca61d97576741": Error response from daemon: error while creating mount source path '/mnt/data': mkdir /mnt/data: read-only file system: RunContainerError
光伏与聚氯乙烯:
(unique-poetry-233821)$ kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
mysql-pv-volume 20Gi RWO Retain Bound default/mysql-pv-claim manual 30m
@cloudshell:~ (unique-poetry-233821)$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
mysql-pv-claim Bound mysql-pv-volume 20Gi RWO manual 31m
最佳答案
删除您的 PV 定义。创建一个 StorageClass,它应该可以工作
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: manual
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-standard
replication-type: none
关于mysql - 为什么我在这个 kubernetes 示例中得到 CrashLoopBackOff?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55637769/
我的图片托管在 GCR 上。我想在我的本地系统 (mac) 上创建 Kubernetes 集群。 我遵循的步骤: 创建一个 imagePullSecretKey 创建通用 key 以与 GCP 通信。
当 Kubernetes Pod 进入 CrashLoopBackOff 状态时,您将修复根本问题。如何强制重新安排时间? 最佳答案 要应用新配置,应创建新 Pod(旧 Pod 将被删除)。 如果您的
我正在设置具有高可用性的kafka和zookeeper集群。我有2个kafka代理(pod1,pod2)和3个zookeeper(pod1,pod2,pod3)。设置工作正常。当我进入一个kafka经
我使用 Google Kubernetes Engine 并且故意在代码中添加了错误。我希望滚动更新会在发现状态为 CrashLoopBackOff 时停止,但事实并非如此。 在此 page , 他们
环境:(内部部署):- K8s-Master Server: Standalone Physical server. OS - CentOS Linux release 8.2.2004 (Core)
我无法在我的1个主节点群集上启动kube-apiserver。 kubelet继续尝试启动服务,但始终获得CrashLoopBackOff。 我试图使用docker run命令运行容器,并且得到以下日
虽然有一些像我一样的问题,但修复对我不起作用。 我正在使用 kubernetes v1.9.3 二进制文件并使用 flannel 和 calico 来设置 kubernetes 集群。应用 calic
Error from server: Get https://10.128.15.203:10250/containerLogs/default/postgres-54db6bdb8b-cmrsb/p
我正在使用kubeadm在CentOS 7.4 / Docker 1.12.6上创建kubernetes v1.9.3集群。 我正在按照Using kubeadm to Create a Cluste
我正在创建一个带有一个初始化容器的复制 Controller 。但是 init 容器无法启动并且 pod 的状态是: NAME READY STAT
我有以下设置: docker hub 上的 docker 镜像 omg/telperion一个 kubernetes 集群(有 4 个节点,每个节点有 ~50GB RAM)和大量资源 我按照教程将图像
我是 Kubernetes 的菜鸟。我正在尝试按照一些方法来启动并运行一个小集群,但是我遇到了麻烦...... 我有一个主节点和 (4) 个节点,都运行 Ubuntu 16.04 在所有节点上安装 d
我正在尝试将容器部署到 AKS,但 Pod 始终处于 CrashLoopBackOff 状态并重新启动。我尝试了不同的 Pod,但显然与这方面无关。 该 Pod 具有非常简单的功能行为,可以在本地正常
我有 2 个虚拟机节点。两者可以通过主机名(通过/etc/hosts)或通过 IP 地址相互查看。已将 kubeadm 配置为 master。另一个作为工作节点。按照说明( http://kubern
我按照以下指南使用 kubeadm 创建了一个 HA 集群: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm
我是OpenWhisk的新手,在安装过程中遇到了一些困难。 由于Pod中的错误,Ngnix Pod正在CrashLoopBackOff中运行。 2018/07/02 16:14:27 [emerg]
我在 ubuntu 16.04 中设置了 kubernetes。我正在使用 kube 版本 1.13.1 并使用 weave 进行网络连接。我已经使用以下方法初始化了集群: sudo kubeadm
我定期看到容器 状态:终止 - OOMKilled (退出代码:137) 但是被调度到内存充足的节点 $ k get statefulset -n metrics NAME
我在 Kubernetes 1.0 中运行一个集群,我有一些容器我想定期运行,作为 pod 中的 sidecar 容器——通常是推送或拉取备份。我通过使用包含我想要备份的数据的容器和用于备份它的 si
我正在使用 kubernetes 集群使用 kubectl create -f dummy.yaml 部署图像。我的图像在 docker hub 中是公开的,图像大小为 1.3 GB。 图像拉取成功但
我是一名优秀的程序员,十分优秀!