我有以下运行良好的代码。example: yes
它在 kubernetes 对象中添加标签:
package main
import (
"fmt"
"encoding/json"
"k8s.io/apimachinery/pkg/types"
eksauth "github.com/chankh/eksutil/pkg/auth"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type patchStringValue struct {
Op string `json:"op"`
Path string `json:"path"`
Value string `json:"value"`
}
func main() {
var updateErr error
cfg := &eksauth.ClusterConfig{ClusterName: "my cluster name"}
clientset, _ := eksauth.NewAuthClient(cfg)
api := clientset.CoreV1()
// Get all pods from all namespaces without the "sent_alert_emailed" label.
pods, _ := api.Pods("").List(metav1.ListOptions{})
for i, pod := range pods.Items {
payload := []patchStringValue{{
Op: "replace",
Path: …
Run Code Online (Sandbox Code Playgroud) 我是 k8 新手,正在学习 DNS 如何在 k8 集群内工作。我能够获取/etc/resolv.conf
默认命名空间中随机 pod 的内容,但无法获取命名空间/etc/resolv.conf
中 coredns pod 的内容kube-system
。
$>kubectl exec kubia-manual-v2 -- cat /etc/resolv.conf
Run Code Online (Sandbox Code Playgroud)
输出:
nameserver 10.96.0.10
$>kubectl exec coredns-74ff55c5b-c8dk6 --namespace kube-system -- cat /etc/resolv.conf
Run Code Online (Sandbox Code Playgroud)
输出:
OCI runtime exec failed: exec failed: container_linux.go:370: starting container process caused: exec: "cat": executable file not found in $PATH: unknown
command terminated with exit code 126
Run Code Online (Sandbox Code Playgroud)
看起来cat
系统二进制文件不存在于$PATH
. 所以,我想知道如何获取/etc/resol.conf
coredns pod 的内容。
我有一个关于 AWSgp3
对 Kubernetes 的支持的问题。
AWS 发布了gp3
EBS 卷类型,该类型显示出比现有卷类型更好的性能gp2
: https: //docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html。
但是,从Kubernetes 文档中,我看不到gp3
Kubernetes 的支持。据我了解,Kubernetes尚不支持gp3
AWS。
我的理解是否正确,或者是否有其他我可能错过的文档?
下面是当我点击目标时 prometheus URL 中的显示。
cadvisor(0/1 向上)和节点导出器(0/1 向上)显示在 Prometheus URL 中
这是我的 filename.yml 文件
version: '3.2'
services:
prometheus:
image: prom/prometheus:latest
# container_name: monitoring_prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
volumes:
- /Prometheus/alert.rules:/etc/prometheus/alert.rules
- /Prometheus/container.yml:/etc/prometheus/container.yml
- /Prometheus/diskusage.yml:/etc/prometheus/diskusage.yml
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- 9090:9090
node-exporter:
image: prom/node-exporter:latest
# container_name: monitoring_node_exporter
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
ports:
- 9091:9091
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--path.rootfs=/host'
- '--collector.filesystem.ignored-mount-points="^(/rootfs|/host|)/(sys|proc|dev|host|etc)($$|/)"'
- '--collector.filesystem.ignored-fs-types="^(sys|proc|auto|cgroup|devpts|ns|au|fuse\.lxc|mqueue)(fs|)$$"'
cadvisor:
image: google/cadvisor:latest
# container_name: monitoring_cadvisor
ports:
- 9092:9092
volumes: …
Run Code Online (Sandbox Code Playgroud) docker prometheus prometheus-operator prometheus-alertmanager prometheus-node-exporter
我正在 k8s (EKS) 上部署 haVault 并在其中一个 Vault Pod 上收到此错误,我认为这也会导致其他 Pod 失败:这是kubectl get events
:
搜索的输出:nodes are available: 1 Insufficient memory
26m Normal Created pod/vault-1 Created container vault
26m Normal Started pod/vault-1 Started container vault
26m Normal Pulled pod/vault-1 Container image "hashicorp/vault-enterprise:1.5.0_ent" already present on machine
7m40s Warning BackOff pod/vault-1 Back-off restarting failed container
2m38s Normal Scheduled pod/vault-1 Successfully assigned vault-foo/vault-1 to ip-10-101-0-103.ec2.internal
2m35s Normal SuccessfulAttachVolume pod/vault-1 AttachVolume.Attach succeeded for volume "pvc-acfc7e26-3616-4075-ab79-0c3f7b0f6470"
2m35s Normal SuccessfulAttachVolume pod/vault-1 AttachVolume.Attach succeeded for …
Run Code Online (Sandbox Code Playgroud) memory configuration kubernetes hashicorp-vault kubernetes-helm
在 Kubernetes 的背景下,我遇到过这些术语Block Storage
,File Storage
但Object Storage
我不明白它们是如何在容器内真正使用(安装)的。我有几个问题,
Block Storage
用于表示块设备的逻辑抽象?Block Storage
像我们在linux上挂载文件系统一样挂载到容器内部的路径吗?这也暗示了一个问题:它是否Block Storage
是一个格式化的文件系统?Object Storage
呈现给容器?容器如何使用它?它是否安装到路径上?File Storage
呈现给容器?容器如何使用它?它是否安装到路径上?file-storage kubernetes google-kubernetes-engine object-storage block-storage
我以为我可以使用此代码来转换字符串:
str = "3,443"
str.replace(",", "")
int_num = int(str)
Run Code Online (Sandbox Code Playgroud)
但它不起作用并引发ValueError
. 我怎样才能转换这个字符串?
kubernetes ×5
amazon-ebs ×1
coredns ×1
docker ×1
file-storage ×1
go ×1
label ×1
memory ×1
patch ×1
prometheus ×1
python ×1