我反复看到类似的东西;
警告FailedSync错误同步窗格,跳过:失败 " StartContainer"对于某些服务"使用RunContainerError: " GenerateRunContainerOptions:无法在ConfigMap中找到关键应用ID 默认/对讲"
部署尝试设置env的位置。来自configmap的变量,即:
apiVersion: v1
data:
intercom: |
app-id=some-id
api-key=some-key
kind: ConfigMap
metadata:
creationTimestamp: 2016-10-23T13:09:58Z
name: intercom
namespace: default
resourceVersion: "3836"
selfLink: /api/v1/namespaces/default/configmaps/intercom
uid: ffeea5f0-9921-11e6-b2b7-0acff65e44c3
部署如下:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: myservice
spec:
replicas: 2
template:
metadata:
labels:
run: myservice
spec:
containers:
- name: myservice
image: somerepo/myservice:v1.0
env:
- name: INTERCOM_APPID
valueFrom:
configMapKeyRef:
name: intercom
key: app-id
- name: INTERCOM_APIKEY
valueFrom:
configMapKeyRef:
name: intercom
key: api-key
ports:
- containerPort: 9000
imagePullSecrets:
- name: docker-hub-key
这里可能有什么问题?
答案 0 :(得分:2)
您的configmap只包含一个密钥:IMAP4_SSL_PORT = 993
while True:
now = datetime.now()
msrver = imaplib.IMAP4_SSL(host = 'myemailserver.com',port = IMAP4_SSL_PORT)
unm = 'usernamehere'
pwd = 'passwordhere'
msrver.login(unm,pwd)
答案 1 :(得分:0)
您可以将配置映射用于环境变量,如下所示
config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-language
data:
LANGUAGE: english
COUNTRY: spain
deployment.yaml
apiVersion: v1
kind: Pod
metadata:
name: alipine-temp
spec:
containers:
- image: alpine
name: alpine-new
envFrom:
- configMapRef:
name: config-language
args:
- /bin/sh
- -c
- while true; do echo hello; sleep 10;done