我按照知识库中的步骤AWS
创建持久存储:在 Amazon EKS 中使用持久存储
不幸的是,PersistentVolume
(PV)没有创建:
kubectl get pv
No resources found
Run Code Online (Sandbox Code Playgroud)
当我检查 PVC 日志时,收到以下配置失败消息:
storageclass.storage.k8s.io "ebs-sc" not found
failed to provision volume with StorageClass "ebs-sc": rpc error: code = DeadlineExceeded desc = context deadline exceeded
Run Code Online (Sandbox Code Playgroud)
我在用着Kubernetes v1.21.2-eks-0389ca3
更新:
示例中使用的 storageclass.yaml 将配置程序设置为 ebs.csi.aws.com
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: ebs-sc
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer
Run Code Online (Sandbox Code Playgroud)
当我使用 @gohm'c 答案更新它时,它创建了一个 pv。
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ebs-sc
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
Run Code Online (Sandbox Code Playgroud) amazon-web-services kubernetes persistent-volumes kubernetes-pvc amazon-eks
目前,我们正在 kuberenetes 上使用dind(我们没有从主机安装 docker.sock)来构建容器映像,并在容器内运行容器以运行单元测试。随着Kubernetes中 Dockershim 的弃用,我正在尝试分析 dind 是否仍然可以在没有 dockershim 且使用 Containerd 运行时的 Kubernetes 上运行。
我尝试在 gcp 和 aws eks 上运行 dind pod,并使用 kubernetes 1.21 版本的 containerd 容器运行时。它在特权模式下工作没有任何问题。但我很困惑它如何工作,因为dind是docker中的docker而不是containerd中的docker。我做了一些研究,但仍然无法弄清楚它是如何工作的以及它是否适用于 kubernetes 1.24 版本。有人可以帮忙吗?
我使用下面的规范使用 containerd 运行时在 kubernetes 上进行测试
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: dind
name: dind
spec:
containers:
- image: docker:20.10.12-dind
name: dind
ports:
- containerPort: 2375
securityContext:
privileged: true
env:
- name: DOCKER_TLS_CERTDIR
value: ''
- name: client
image: ubuntu:latest
command:
- sleep
- …
Run Code Online (Sandbox Code Playgroud) 我在公共子网中创建了一个具有 1 个工作节点的新 EKS 集群。我能够查询节点、连接到集群并运行 pod 创建命令,但是,当我尝试创建 pod 时,它失败并出现通过描述 pod 得到的以下错误。请指导。
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 81s default-scheduler 0/1 nodes are available: 1 Too many pods. preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod.
Warning FailedScheduling 16m default-scheduler 0/2 nodes are available: 2 Too many pods, 2 node(s) had untolerated taint {node.kubernetes.io/unschedulable: }, 2 node(s) were unschedulable. preemption: …
Run Code Online (Sandbox Code Playgroud) 在按照本指南error: the server doesn't have a resource type "svc"
测试kubectl
配置时获取:
https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html
$ kubectl get svc -v=8
I0712 15:30:24.902035 93745 loader.go:357] Config loaded from file /Users/matt.canty/.kube/config-test
I0712 15:30:24.902741 93745 round_trippers.go:383] GET https://REDACTED.yl4.us-east-1.eks.amazonaws.com/api
I0712 15:30:24.902762 93745 round_trippers.go:390] Request Headers:
I0712 15:30:24.902768 93745 round_trippers.go:393] User-Agent: kubectl/v1.10.3 (darwin/amd64) kubernetes/2bba012
I0712 15:30:24.902773 93745 round_trippers.go:393] Accept: application/json, */*
I0712 15:30:25.425614 93745 round_trippers.go:408] Response Status: 401 Unauthorized in 522 milliseconds
I0712 15:30:25.425651 93745 round_trippers.go:411] Response Headers:
I0712 15:30:25.425657 93745 round_trippers.go:414] Content-Type: application/json
I0712 …
Run Code Online (Sandbox Code Playgroud) 我正在尝试为应用程序完成一项非常常见的任务:
分配证书并使用TLS/HTTPS保护它.
我花了近一天时间通过文档搜索并尝试了多种不同的策略来实现这一点,但没有什么对我有用.
最初我使用Helm在EKS上设置nginx-ingress,遵循以下文档:https://github.com/nginxinc/kubernetes-ingress.我尝试使用以下配置使示例应用程序工作(咖啡馆):
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: cafe-ingress
spec:
tls:
- hosts:
- cafe.example.com
secretName: cafe-secret
rules:
- host: cafe.example.com
http:
paths:
- path: /tea
backend:
serviceName: tea-svc
servicePort: 80
- path: /coffee
backend:
serviceName: coffee-svc
servicePort: 80
Run Code Online (Sandbox Code Playgroud)
入口和所有支持的服务/部署工作正常,但有一个主要的缺失:入口没有相关的地址/ ELB:
NAME HOSTS ADDRESS PORTS AGE
cafe-ingress cafe.example.com 80, 443 12h
Run Code Online (Sandbox Code Playgroud)
Service LoadBalancers创建ELB资源,即:
testnodeapp LoadBalancer 172.20.4.161 a64b46f3588fe... 80:32107/TCP 13h
Run Code Online (Sandbox Code Playgroud)
但是,Ingress没有创建地址.如何在EKS上外部暴露出Ingress控制器来处理TLS/HTTPS?
让我描述一下我的情况:
当我在带有1个附加卷的Kubernetes上创建部署时,一切工作正常。当我创建相同的部署,但附加了第二个卷(总计:2个卷)时,吊舱因错误而卡在“待定”上:
pod has unbound PersistentVolumeClaims (repeated 2 times)
0/2 nodes are available: 2 node(s) had no available volume zone.
Run Code Online (Sandbox Code Playgroud)
已检查是否在正确的可用区中创建了卷。
我有一个使用2个节点的Amazon EKS设置的集群。我有以下默认存储类:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: gp2
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
reclaimPolicy: Retain
mountOptions:
- debug
Run Code Online (Sandbox Code Playgroud)
我有一个mongodb部署,它需要两个卷,一个卷安装在/data/db
文件夹上,另一个卷安装在我需要的某个随机目录中。这是用于创建三个组件的最小Yaml(我故意评论了几行):
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: my-project
creationTimestamp: null
labels:
io.kompose.service: my-project-db-claim0
name: my-project-db-claim0
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: my-project
creationTimestamp: …
Run Code Online (Sandbox Code Playgroud) 我在专用子网中运行EKS,因此无法创建面向Internet的负载均衡器,但能够创建内部LoadBalancer。
有什么方法可以在公共子网中创建Loadbalancer(可能是手动)并指向在私有子网中的EKS中运行的Pod。
我正在考虑创建一个负载平衡器链,其中外部负载平衡器将指向内部负载平衡器,但这也是不可能的,因为内部负载平衡器的IP地址是保留IP。
我可以尝试其他方法将流量从互联网路由到Pod吗?
internal-load-balancer kubernetes-ingress aws-load-balancer amazon-eks
我已经为我的应用程序配置了亚马逊证书管理器、ALB 入口控制器和域名。我可以通过端口 80 和端口 443 访问我的应用程序(所有证书都可以正常工作)。但是,我想将所有来自 HTTP 的流量自动重定向到 HTTPS,以便将自己输入域名的人重定向到 HTTPS。我按照这个网页和这一个,但我不能使它工作
这是我的 ingress.yaml 文件:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: metabase
namespace: bigdata
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-2:***:certificate/***
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
alb.ingress.kubernetes.io/scheme: internet-facing
labels:
app: metabase
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: ssl-redirect
servicePort: use-annotation
- path: /*
backend:
serviceName: metabase
servicePort: 3000
Run Code Online (Sandbox Code Playgroud)
这是我的服务:
apiVersion: v1
kind: Service
metadata:
name: metabase …
Run Code Online (Sandbox Code Playgroud) 我正在尝试对我们的一些内部服务(网格内部)应用速率限制。
我使用了文档中的示例并生成了 redis 速率限制配置,其中包括(redis)处理程序、配额实例、配额规范、配额规范绑定和应用处理程序的规则。
这个 redis 处理程序:
apiVersion: config.istio.io/v1alpha2
kind: handler
metadata:
name: redishandler
namespace: istio-system
spec:
compiledAdapter: redisquota
params:
redisServerUrl: <REDIS>:6379
connectionPoolSize: 10
quotas:
- name: requestcountquota.instance.istio-system
maxAmount: 10
validDuration: 100s
rateLimitAlgorithm: FIXED_WINDOW
overrides:
- dimensions:
destination: s1
maxAmount: 1
- dimensions:
destination: s3
maxAmount: 1
- dimensions:
destination: s2
maxAmount: 1
Run Code Online (Sandbox Code Playgroud)
配额实例(我目前只对按目的地进行限制感兴趣):
apiVersion: config.istio.io/v1alpha2
kind: instance
metadata:
name: requestcountquota
namespace: istio-system
spec:
compiledTemplate: quota
params:
dimensions:
destination: destination.labels["app"] | destination.service.host | "unknown"
Run Code Online (Sandbox Code Playgroud)
配额规范,如果我理解正确,每个请求收费 1:
apiVersion: config.istio.io/v1alpha2
kind: QuotaSpec …
Run Code Online (Sandbox Code Playgroud) 尝试使用 amazon eks 创建 fargate 配置文件时(使用命令 eksctl create cluster --name myclustername --version 1.14 --fargate),我得到
[?] all EKS cluster resources for "myclustername" have been created
[?] saved kubeconfig as "/home/connor/.kube/config"
[?] creating Fargate profile "fp-default" on EKS cluster "myclustername"
Error: failed to create Fargate profile "fp-default" on EKS cluster "myclustername": failed to create Fargate profile "fp-default": AccessDeniedException: Account 339969016160 is not authorized to use this service
status code: 403, request id: 1db7cf38-002e-48b8-8fa6-8a7b7eab324d
Run Code Online (Sandbox Code Playgroud)
关于我需要添加什么权限来解决这个问题的任何想法?我更喜欢尽可能通过 cli 进行所有管理
amazon-eks ×10
kubernetes ×7
amazon-iam ×1
aws-eks ×1
aws-fargate ×1
containers ×1
docker ×1
eksctl ×1
handler ×1
istio ×1
kubectl ×1
redis ×1