- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在寻求有关如何将第二个容器添加到现有 pod(我的意思是一个带有两个容器的 pod)的帮助。错误是 CrashLoopBackOff .我正在使用 minikube。我请求任何帮助解决问题将不胜感激。
wordpress.yaml
--------XXXX------------------
apiVersion: v1
kind: Service
metadata:
name: my-nginx-svc
labels:
app: nginx
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: nginx
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
- name: wordpress
image: wordpress
ports:
- containerPort: 80
#watch kubectl get pods
Every 2.0s: kubectl get pods cent8-minikube: Wed Jun 10 16:47:30 2020
NAME READY STATUS RESTARTS AGE
my-nginx-6b474476c4-9p4cn 1/1 Running 0 5h41m
my-nginx-6b474476c4-m2xkd 1/1 Running 0 5h41m
my-nginx-9f44b5996-744n5 1/2 CrashLoopBackOff 9 21m
my-nginx-9f44b5996-vl6g2 1/2 CrashLoopBackOff 9 22m
test-minikube-f4df69575-2sbl5 1/1 Running 0 26h
[root@cent8-minikube ~]# kubectl describe pod my-nginx-9f44b5996-vl6g2
Name: my-nginx-9f44b5996-vl6g2
Namespace: default
Priority: 0
Node: cent8-minikube/192.168.194.128
Start Time: Wed, 10 Jun 2020 16:25:14 -0700
Labels: app=nginx
pod-template-hash=9f44b5996
Annotations: <none>
Status: Running
IP: 172.17.0.8
IPs:
IP: 172.17.0.8
Controlled By: ReplicaSet/my-nginx-9f44b5996
Containers:
nginx:
Container ID: docker://5e4cfd4e726373916a105a95644a7a286966482e33eaaac986e44514aef86606
Image: nginx:1.14.2
Image ID: docker-pullable://nginx@sha256:f7988fb6c02e0ce69257d9bd9cf37ae20a60f1df7563c3a2a6abe24160306b8d
Port: 80/TCP
Host Port: 0/TCP
State: Running
Started: Wed, 10 Jun 2020 16:25:16 -0700
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-lqnj8 (ro)
wordpress:
Container ID: docker://5e37277badca1658a10d4d826428f538a45d5e0eaecabd5e196f8b6ab5848ec7
Image: wordpress
Image ID: docker-pullable://wordpress@sha256:ff8be61894e74b6a005ab54ba73aa7084b6dbd11605f12ac383549763918bf09
Port: 80/TCP
Host Port: 0/TCP
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: Error
Exit Code: 1
Started: Wed, 10 Jun 2020 16:46:37 -0700
Finished: Wed, 10 Jun 2020 16:46:38 -0700
Ready: False
Restart Count: 9
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-lqnj8 (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
default-token-lqnj8:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-lqnj8
Optional: false
QoS Class: BestEffort
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 23m default-scheduler Successfully assigned default/my-nginx-9f44b5996-vl6g2 to cent8-minikube
Normal Pulled 23m kubelet, cent8-minikube Container image "nginx:1.14.2" already present on machine
Normal Created 23m kubelet, cent8-minikube Created container nginx
Normal Started 23m kubelet, cent8-minikube Started container nginx
Normal Pulling 22m (x4 over 23m) kubelet, cent8-minikube Pulling image "wordpress"
Normal Pulled 22m (x4 over 23m) kubelet, cent8-minikube Successfully pulled image "wordpress"
Normal Created 22m (x4 over 23m) kubelet, cent8-minikube Created container wordpress
Normal Started 22m (x4 over 23m) kubelet, cent8-minikube Started container wordpress
Warning BackOff 3m35s (x95 over 23m) kubelet, cent8-minikube Back-off restarting failed container
[root@cent8-minikube ~]#
[root@cent8-minikube ~]# kubectl describe pod my-nginx-9f44b5996-744n5
Name: my-nginx-9f44b5996-744n5
Namespace: default
Priority: 0
Node: cent8-minikube/192.168.194.128
Start Time: Wed, 10 Jun 2020 16:25:33 -0700
Labels: app=nginx
pod-template-hash=9f44b5996
Annotations: <none>
Status: Running
IP: 172.17.0.10
IPs:
IP: 172.17.0.10
Controlled By: ReplicaSet/my-nginx-9f44b5996
Containers:
nginx:
Container ID: docker://9e3d6f0073e51eb475c2f2677fa413509f49a07c955d04b09417811d37ba8433
Image: nginx:1.14.2
Image ID: docker-pullable://nginx@sha256:f7988fb6c02e0ce69257d9bd9cf37ae20a60f1df7563c3a2a6abe24160306b8d
Port: 80/TCP
Host Port: 0/TCP
State: Running
Started: Wed, 10 Jun 2020 16:25:35 -0700
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-lqnj8 (ro)
wordpress:
Container ID: docker://2ca8f22ab14b88973dca8d4d486f82a5b0d9bc7b84960882cff0a81afd744bf4
Image: wordpress
Image ID: docker-pullable://wordpress@sha256:ff8be61894e74b6a005ab54ba73aa7084b6dbd11605f12ac383549763918bf09
Port: 80/TCP
Host Port: 0/TCP
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: Error
Exit Code: 1
Started: Wed, 10 Jun 2020 16:46:41 -0700
Finished: Wed, 10 Jun 2020 16:46:42 -0700
Ready: False
Restart Count: 9
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-lqnj8 (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
default-token-lqnj8:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-lqnj8
Optional: false
QoS Class: BestEffort
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 26m default-scheduler Successfully assigned default/my-nginx-9f44b5996-744n5 to cent8-minikube
Normal Pulled 26m kubelet, cent8-minikube Container image "nginx:1.14.2" already present on machine
Normal Created 26m kubelet, cent8-minikube Created container nginx
Normal Started 26m kubelet, cent8-minikube Started container nginx
Normal Pulling 25m (x4 over 26m) kubelet, cent8-minikube Pulling image "wordpress"
Normal Pulled 25m (x4 over 26m) kubelet, cent8-minikube Successfully pulled image "wordpress"
Normal Created 25m (x4 over 26m) kubelet, cent8-minikube Created container wordpress
Normal Started 25m (x4 over 26m) kubelet, cent8-minikube Started container wordpress
Warning BackOff 67s (x116 over 26m) kubelet, cent8-minikube Back-off restarting failed container
[root@cent8-minikube ~]#
``` [root@cent8-minikube ~]# kubectl logs my-nginx-9f44b5996-vl6g2 -c wordpress WordPress not found in /var/www/html - copying now... Complete! WordPress has been successfully copied to /var/www/html AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.8. Set the 'ServerName' directive globally to suppress this message (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down AH00015: Unable to open logs
最佳答案
虽然我同意在单独的 Pod 中运行单独的应用程序,但有时将它们放在一起更容易。在目前的情况下,这可以通过以下方式实现:
Wordpress 是硬配置,因此将 Nginx 移动到单独的端口更可行(如果不是完全直接的话)
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx
data:
default.conf.template: |
server {
listen ${NGINX_PORT};
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
env:
- name: NGINX_PORT
value: "81"
volumeMounts:
- mountPath: /etc/nginx/templates/
name: config
ports:
- containerPort: 81
- name: wordpress
image: wordpress
ports:
- containerPort: 80
volumes:
- name: config
configMap:
name: nginx
关于kubernetes - minikube : how to add second container to the pod?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62316293/
我已在本地设置 Docker 引擎以在 minikube 上运行(而不是使用 Docker Desktop)。我知道我需要确保引擎与 minikube 集群“对话”。我查阅了两个教程,它们的说明略有不
我正在尝试创建 minikube 集群,但它总是失败。 非常欢迎任何建议: C:\WINDOWS\system32>minikube 启动 --driver=vmware Microsoft Wind
我正在尝试调查网络问题并想安装 tcpdump/tshark。 minikube 使用什么包管理器?如何安装 tcpdump? 最佳答案 这不是一件容易的事。 Minikube VM 基于 Build
我正在尝试使用 https://kubernetes.io/docs/tasks/tools/install-minikube/ 在 RHEL 7.4 上安装 minikube .我的系统设置了无密码
我正在运行 minikube。 Minikube 状态结果为: kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99
如何将自定义 ssh 公钥放入 minikube 集群上的 authorized_keys 中?为什么对 /home/docker/.ssh/authorized_keys 的更改在重启后会丢失?如何
我在 Windows 10 上。命令“systeminfo”显示: Hyper-V Requirements: A hypervisor has been detected. Features req
我正在 Linux 工作站上使用 podman 和 minikube 探索和学习容器和 kubernetes。我使用 podman 在工作站上构建镜像,并希望使用 kvm2 虚拟机驱动程序将这些镜像部
当我运行以下代码时: minikube addons enable ingress 我收到以下错误: ▪ Using image k8s.gcr.io/ingress-nginx/controller
我想在每次启动和停止时为我的 ubuntu 主机(带有 KVM2)上的 minikube 集群(输入 minikube ip 时获得的那个)设置一个固定的 IP 地址。 我想将一个 DNS 子域指向它
我刚刚使用以下命令在 Ubuntu 18.04 上为我的 Kubernetes 本地设置安装了 Minikube: curl -LO https://storage.googleapis.com/mi
编辑 - 这是在 OSX 上 另外,我试过运行 minikube service ,如下所示,当它尝试在浏览器中打开它时,我收到“连接被拒绝”信号,因为端口已关闭。 我有一个 kubernetes
我想在每次启动和停止时为我的 ubuntu 主机(带有 KVM2)上的 minikube 集群(输入 minikube ip 时获得的那个)设置一个固定的 IP 地址。 我想将一个 DNS 子域指向它
我对 Kubernetes“非常”陌生,我想在运行 Windows 10 和 HyperV 的本地机器上试用它。我看到了 minikube用于本地开发,我可以在 Chocolatey 上找到,所以我使
我正在尝试通过 hyperv 在我的本地 Windows 10 机器上安装 kubernetes。我遇到了一些我不确定如何解决的错误。我也尝试过运行 kubernetes v1.8.0,但收到了同样的
我有一个可以在多个环境中工作的简单入口文件,但要访问它,它的行为会有所不同,具体取决于我是在我的 Mac 上还是在我的 Ubuntu 机器上运行我的 minikube 集群。 具体来说,对于我的 ma
是否可以使用 minikube 在特定端口上公开服务? kubectl expose deployment my-deployment --type=NodePort --port=80 不会抛出错误
我正在尝试使用嵌入式仪表板内部服务为 minikube 仪表板创建入口。 我同时启用了 ingress和 dashboard minikube 插件。 我还写了这个 ingress YAML 文件:
你好,所以我昨天使用 minikube,它工作正常,但今天我试图用 minikube start 命令开始,它给出了以下错误: 在运行 minikube status 之后,它会给出以下结果: 提前感
我在 macOS 上升级了 minikube,现在我无法启动它(在两台不同的机器上)。我一直在阅读一堆论坛,这似乎是一个常见问题,但没有一致的解决方案,也没有关于如何寻找根本原因的指导。 首次下载 V
我是一名优秀的程序员,十分优秀!