我是新的 AKS、ACR 和 DevOps 管道,我正在尝试设置 CI/CD 管道。
我有一个资源组设置,其中包含 AKS 和 ACR。AKS 正在使用Standard_B2s并且此时只有一个节点,因为我只是在玩。
图像在提交给 master 时自动部署到 ACR——还没有想出如何设置测试——但是在部署到 AKS 时,我只是不断得到:
##[error]error: deployment "client-deployment" exceeded its progress deadline
Run Code Online (Sandbox Code Playgroud)
我已经改变了我client.yaml对包括progressDeadlineSeconds像一个小时为10,15和20分钟没有工作:
apiVersion: apps/v1
kind: Deployment
metadata:
name: client-deployment
spec:
progressDeadlineSeconds: 3600
replicas: 1
selector:
matchLabels:
component: client
template:
metadata:
labels:
component: client
spec:
containers:
- name: client
image: testappcontainers.azurecr.io/testapp-client
ports:
- containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: client-cluster-ip-service
spec:
type: ClusterIP
selector:
component: client
ports:
- …Run Code Online (Sandbox Code Playgroud) 有没有办法排除某些命名空间fluent-bit?我想排除某些命名空间,因此fluent-bit不会将在这些命名空间中创建的所有日志转发到 ELK。
除了为该命名空间中的每个 pod 添加注释之外,还有其他方法吗?我知道您可以通过 kubectl 更新命名空间中的所有 pod 注释。
kubectl annotate pods --namespace=pks-system --all fluentbit.io/exclude='true'
在我的 terraform 配置文件中,我在 GKE 上创建了一个 Kubernetes 集群,创建后,设置一个 Kubernetes 提供程序来访问所述集群并执行各种操作,例如设置命名空间。
问题是在没有 terraform 的集群中创建了一些新的命名空间,现在我尝试将这些命名空间导入我的状态似乎由于无法连接到集群而失败,我认为这是由于以下原因(取自 Terraform 的官方文档)导入命令):
Terraform 在读取配置文件时的唯一限制是导入提供程序配置不能依赖于非变量输入。例如,提供程序配置不能依赖于数据源。
我用来导入命名空间的命令非常简单:
terraform import kubernetes_namespace.my_new_namespace my_new_namespace
我也尝试使用-provdier=""和-config=""但无济于事。
我的 Kubernetes 提供程序配置是这样的:
provider "kubernetes" {
version = "~> 1.8"
host = module.gke.endpoint
token = data.google_client_config.current.access_token
cluster_ca_certificate = base64decode(module.gke.cluster_ca_certificate)
}
Run Code Online (Sandbox Code Playgroud)
我试图导入的命名空间资源的一个例子是:
resource "kubernetes_namespace" "my_new_namespace" {
metadata {
name = "my_new_namespace"
}
}
Run Code Online (Sandbox Code Playgroud)
导入命令的结果如下:
错误:获取http://localhost/api/v1/namespaces/my_new_namespace : dial tcp [::1]:80: connect: connection denied
很明显,它注定要失败,因为它试图访问localhost而不是实际的集群 IP 和配置。
这个用例有什么解决方法吗?
提前致谢。
我有一些在集群中运行的burstable pod,我不希望在内存/ CPU压力的情况下被杀死.
有没有办法增加它的优先级或其他东西,这样我们就不必改变它的名称空间(kube-system使它变得至关重要)并且可以保存它?
我发现了一些有关为pod添加优先级的问题.但无法弄清楚解决方案.应该有一些方法来设置优先级,还是我错过了一些大的东西?
如何强制删除停留在终止中的命名空间?
apiVersion: v1
kind: Namespace
metadata:
name: delete-me
spec:
finalizers:
- foregroundDeletion
Run Code Online (Sandbox Code Playgroud)
kubectl delete ns delete-me
无法删除delete-me。
我发现的唯一解决方法是销毁并重新创建整个集群。
这些都不起作用或修改命名空间。在所有这些之后,有问题的终结器仍然存在。
kubectl apply应用:
apiVersion: v1
kind: Namespace
metadata:
name: delete-me
spec:
finalizers:
Run Code Online (Sandbox Code Playgroud)
$ kubectl apply -f tmp.yaml
namespace/delete-me configured
Run Code Online (Sandbox Code Playgroud)
该命令无错误地结束,但是名称空间未删除。
下面的YAML具有相同的结果:
apiVersion: v1
kind: Namespace
metadata:
name: delete-me
spec:
Run Code Online (Sandbox Code Playgroud)
kubectl editkubectl edit ns delete-me,然后删除终结器。同上完全删除列表。同上删除spec。同上替换finalizers为空列表。
$ kubectl edit ns delete-me
namespace/delete-me edited
Run Code Online (Sandbox Code Playgroud)
这不会显示任何错误信息,但不会更新命名空间。kubectl edit再次查看该对象将显示终结器仍然存在。
kubectl proxy &kubectl …Kubernetes集群是否支持最大数量的命名空间?我的团队正在设计一个通过K8来运行用户工作负载的系统,我们正在考虑为每个用户使用一个名称空间在集群中提供逻辑分段,但是我们不想限制可以使用我们服务的用户数量。
我们正在使用Amazon的EKS托管Kubernetes服务和Kubernetes v1.11。
Kubernetes 命名空间究竟是什么,它与 linux 命名空间(mnt、pid、net、ipc、uts、user、cgroup)有何不同?
这是资源状态:
kind: Namespace
api
Version: v1
metadata:
name: linkerd
selfLink: /api/v1/namespaces/linkerd
uid: e7337b2b-bddb-4344-a986-d450973bc8cf
resourceVersion: '5540346'
creationTimestamp: '2020-05-10T13:49:21Z'
deletionTimestamp: '2020-06-03T20:16:30Z'
labels:
config.linkerd.io/admission-webhooks: disabled
linkerd.io/is-control-plane: 'true'
spec:
finalizers:
- kubernetes
status:
phase: Terminating
conditions:
- type: NamespaceDeletionDiscoveryFailure
status: 'True'
lastTransitionTime: '2020-06-03T20:16:44Z'
reason: DiscoveryFailed
message: >-
Discovery failed for some groups, 1 failing: unable to retrieve the
complete list of server APIs: tap.linkerd.io/v1alpha1: the server is
currently unable to handle the request
- type: NamespaceDeletionGroupVersionParsingFailure
status: 'False'
lastTransitionTime: '2020-06-03T20:16:38Z'
reason: ParsedGroupVersions
message: All …Run Code Online (Sandbox Code Playgroud) digital-ocean kubernetes kubectl linkerd kubernetes-namespace
我需要将集群、命名空间和 pod 名称从我部署在 Kubernetes 集群中的容器传递给 AppDynamics 代理。
我尝试了以下内容,但这不起作用。
containers:
- env:
- name: JAVA_OPTS
value: -Dappdynamics.agent.nodeName=$HOST-$spec.nodeName-spec.PodName
Run Code Online (Sandbox Code Playgroud)
和
- name: appdynamics.agent.nodeName
value= $HOST-$spec.nodeName-spec.PodName
Run Code Online (Sandbox Code Playgroud)
任何人都可以在这里帮助我如何收集详细信息并传递给AppD。提前致谢。
我的 Kubernetes 集群中有一个命名空间无法删除。当我运行时kubectl get ns traefik -o yaml,我得到以下信息:
apiVersion: v1
kind: Namespace
metadata:
annotations:
cattle.io/status: '{"Conditions":[{"Type":"ResourceQuotaInit","Status":"True","Message":"","LastUpdateTime":"2021-06-11T20:28:59Z"},{"Type":"InitialRolesPopulated","Status":"True","Message":"","LastUpdateTime":"2021-06-11T20:29:00Z"}]}'
field.cattle.io/projectId: c-5g2hz:p-bl9sf
lifecycle.cattle.io/create.namespace-auth: "true"
creationTimestamp: "2021-06-11T20:28:58Z"
deletionTimestamp: "2021-07-04T07:21:20Z"
labels:
field.cattle.io/projectId: p-bl9sf
managedFields:
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:field.cattle.io/projectId: {}
f:labels:
.: {}
f:field.cattle.io/projectId: {}
f:status:
f:phase: {}
manager: agent
operation: Update
time: "2021-06-11T20:28:58Z"
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
f:cattle.io/status: {}
f:lifecycle.cattle.io/create.namespace-auth: {}
manager: rancher
operation: Update
time: "2021-06-11T20:28:58Z"
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1: …Run Code Online (Sandbox Code Playgroud) kubernetes ×11
amazon-eks ×1
appdynamics ×1
azure-aks ×1
fluent-bit ×1
import ×1
kubectl ×1
linkerd ×1
pod-priority ×1
terraform ×1
traefik ×1