我正在尝试为应用程序完成一项非常常见的任务:
分配证书并使用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?
我有一个列表,用于处理目录上的一系列任务。有时,该过程会卡在某个目录中。目前我正在删除该元素并通过列表重新运行该过程。然而,这需要一段时间。
这是我现在正在做的事情:
directories = next(os.walk('/home'))[1]
directories.remove('brokendirectory')
process_directory(directory)
Run Code Online (Sandbox Code Playgroud)
我想要做的是删除每个目录,包括损坏的目录,并且只在该损坏目录之后的目录列表上工作。像这样的东西:
def clear_list(directories, element):
new_list = []
for directory in directories:
if directory == element:
break
else:
new_list.append(directory)
return(new_list)
directories = next(os.walk('/home'))[1]
new_directories = clear_list(directories,'brokendirectory')
process_directory(new_directories)
Run Code Online (Sandbox Code Playgroud)
显然,我的函数不能按原样工作。
如何删除列表中的所有元素,包括指定的元素并返回一个新列表进行处理?
我想在 Secrets Manager 中创建一个新的密钥。秘密必须是键/值对。当我使用 CLI 创建密钥时,它存储为纯文本而不是键/值对:
aws secretsmanager create-secret --name github/oauthtoken \
--description "GitHub OAuth Token" \
--secret-string file:///tmp/github_oauth.json
Run Code Online (Sandbox Code Playgroud)
github_oauth.json
[
{
"Key": "oauth_token",
"Value": "MYOAUTHTOKEN"
}
]
Run Code Online (Sandbox Code Playgroud)
当我尝试解析 CloudFormation 中的秘密时,出现错误:
Secrets Manager can?t find the specified secret.
Run Code Online (Sandbox Code Playgroud)
当我在 Secrets Manager UI 中访问密钥时,密钥为纯文本形式,并在密钥/值下出现错误:
The secret value can't be converted to key name and value pairs
Run Code Online (Sandbox Code Playgroud)
如何在 Secrets Manager 中创建存储为键/值对的密钥?
我正在尝试使用这个非常简单的命令创建一个 JSON 文件:
jq -n --arg greeting world --arg mykey hello '{"hello":$greeting}'
我的问题是,当我用 $mykey 替换密钥时,出现此错误:
# jq -n --arg greeting world --arg mykey hello {$mykey:$greeting}
jq: error: syntax error, unexpected ':' (Unix shell quoting issues?) at <top-level>, line 1:
{:}
jq: 1 compile error
Run Code Online (Sandbox Code Playgroud)
如何创建一个带有两个参数/变量的简单 JSON 文件?