我正在测试PDF417 zxing libs,但调整输出大小并不像我检测到的那样有效.输出始终具有相同的宽高比.
更改尺寸不会影响输出,我按照其他消息中的建议尝试了EncodeHintType,但没有成功.这里的代码:
public class PDF417demo {
public static void main(String[] args) {
String barcodeMessage = "test";
final String PATH = "/home/test/";
final int WIDTH = 30;
BitMatrix bitMatrix;
Writer writer;
try {
Map hints = new HashMap();
hints.put(EncodeHintType.MARGIN, 2);
hints.put(EncodeHintType.PDF417_DIMENSIONS, new Dimensions(20,100,20,100) );
writer = new PDF417Writer();
bitMatrix = writer.encode(barcodeMessage, BarcodeFormat.PDF_417, WIDTH, WIDTH/2, hints);
MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(new File(PATH + "pdf417_demo.png")));
System.out.println("PDF417 Code Generated.");
} catch (Exception e) {
System.out.println("Exception Found." + e.getMessage());
}
}
}
Run Code Online (Sandbox Code Playgroud)
你能建议我怎么做吗?先感谢您.尼克
我尝试mongo在 kubernetes 集群上配置身份验证。我部署了以下内容yaml:
kind: StatefulSet
metadata:
name: mongo
spec:
serviceName: "mongo"
replicas: 1
template:
metadata:
labels:
app: mongo
spec:
containers:
- name: mongodb
image: mongo:4.0.0
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: "admin"
- name: MONGO_INITDB_ROOT_PASSWORD
# Get password from secret
value: "abc123changeme"
command:
- mongod
- --auth
- --replSet
- rs0
- --bind_ip
- 0.0.0.0
ports:
- containerPort: 27017
name: web
volumeMounts:
- name: mongo-ps
mountPath: /data/db
volumes:
- name: mongo-ps
persistentVolumeClaim:
claimName: mongodb-pvc
Run Code Online (Sandbox Code Playgroud)
当我尝试使用用户名“admin”和密码“abc123changeme”进行身份验证时,我收到了"Authentication failed." …
我的微服务(Kubernetes 中的 springboot+actuator)暴露了/metrics端点。
从 pod 中,我可以使用一个简单的方法来检索指标 curl svc:8080/metrics
但是在 Prometheus 目标中,我收到此错误: INVALID is not a valid start token
我的prometheus.yml是以下内容:
global:
scrape_interval: 60s
scrape_timeout: 10s
evaluation_interval: 10s
alerting:
alertmanagers:
- static_configs:
- targets:
- alertmanager:9093
rule_files:
- "/etc/prometheus-rules/usage.rules"
- "/etc/prometheus-rules/availability.rules"
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets:
- prometheus:9090
- job_name: 'kubernetes-apiservers'
kubernetes_sd_configs:
- role: endpoints
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: default;kubernetes;https
- job_name: 'kubernetes-nodes'
kubernetes_sd_configs: …Run Code Online (Sandbox Code Playgroud) 我正在使用给定的配置与 Thanos 一起部署 Prometheus:
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: %%CLUSTER%%
replica: $(HOSTNAME)
Run Code Online (Sandbox Code Playgroud)
我从 Thanos 示例文档中得到了这个,但我无法使其工作。“%%CLUSTER%% 给出“无法以给定令牌开始”错误,而 HOSTNAME 替换从未发生。
我在这个问题上读到不支持变量替换,但 Thanos 文档另有说明。 https://github.com/prometheus/prometheus/issues/2357
还有其他方法可以实现吗?
我正在使用 kubernetes 运行多个 pod 副本,deployment
我想更新副本以使用configmap滚动方式更新。就像滚动更新一样。
这样 kubernetes 将终止 pod 并开始一次向新更新的 pod 发送流量,直到所有 pod 都被更新。
我可以在部署中使用滚动更新吗?
docker google-cloud-platform kubernetes google-kubernetes-engine
当前,我正在使用R版本3.4.4。我正在尝试使用R包的“效果”。但是我无法在此版本上安装和使用此软件包。
code
install.packages("effects")
library(effects)
plot(allEffects(lm_g_sc), type="response")
Run Code Online (Sandbox Code Playgroud)
结果
install.packages中的警告:软件包“效果”不可用(对于R版本3.4.4)
我能做什么?如果我不能使用此软件包,还有其他替代软件包吗?
我正在 k8s 集群中的 tomcat 上运行 java 应用程序,我正在使用 prestop 生命周期钩子/usr/local/tomcat/bin/shutdown.sh在容器终止之前运行。还定义了 60 秒的终止宽限期。
预期行为:当我杀死一个 pod 或删除一个部署时,tomcat 会正常关闭。
实际行为:tomcat 突然关闭。
有什么想法吗?提前致谢。
apiVersion: apps/v1
kind: Deployment
metadata:
name: sample
annotations:
spec:
replicas: 2
selector:
matchLabels:
app: sample
name: sample
template:
metadata:
labels:
app: sample
name: sample
spec:
hostname: sample-web
terminationGracePeriodSeconds: 60
volumes:
- name: splunk-inputs
configMap:
name: splunk-conf
items:
- key: inputs.conf
path: ./inputs.conf
- name: splunk-outputs
configMap:
name: splunk-conf
items:
- key: outputs.conf
path: ./outputs.conf
- name: docker-socket
hostPath:
path: /var/run/docker.sock …Run Code Online (Sandbox Code Playgroud) 我尝试traefik在GKE(google cloud kubernetes引擎)上安装为入口控制器,并且在尝试时:
kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml
Run Code Online (Sandbox Code Playgroud)
我有这个错误:
来自服务器的错误(禁止):创建“ https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml时出错“ :: clusterroles.rbac.authorization.k8s.io“ traefik-ingress-controller”被禁止:尝试授予额外的特权:[PolicyRule {APIGroups:[“”],资源:[“服务”],动词:[“ get “]} PolicyRule {APIGroups:[”“],资源:[” services“],动词:[” list“]} PolicyRule {APIGroups:[”“],资源:[” services“],动词:[”监视“]} PolicyRule {APIGroups:[”“],资源:[” endpoints]],动词:[“ get”]} PolicyRule {APIGroups:[“”],资源:[“ endpoints”],动词:[“列表“]} PolicyRule {APIGroups:[”“],资源:[”端点“],动词:[” watch“]} PolicyRule {APIGroups:[”“],资源:[” secrets“],动词:[” get “]} PolicyRule {APIGroups:[“”],资源:[“ secrets”],动词:[“ list”]} PolicyRule {APIGroups:[“”],资源:[“ secrets”],动词:[“ watch”]} PolicyRule {APIGroups: [“扩展名”],资源:[“入口”],动词:[“ get”]} PolicyRule {APIGroups:[“扩展名”],资源:[“入口”],动词:[“列表”]} PolicyRule { APIGroups:[“扩展名”],资源:[“ ingresses”],动词:[“ watch”]}] user=&{IzoPi4a@gmail.com [system:authenticated] map [user-assertion.cloud.google.com :[ADKE0IBz9kwSuZRZkfbLil8iC / ijcmJJmuys2DvDGxoxQ5yP6Pdq1IQs3JRwDmd / lWm2vGdMXGB4h1QKiwx + 3uV2ciTb / oQNtkthBvONnVp4fJGOSW1S + 8O8dqvoUNRLNeB5gADNn1TKEYoB + JvRkjrkTOxtIh7rPugLaP5Hp7thWft9xwZqF9U4fgYHnPjCdRgvMrDvGIK8z7ONljYuStpWdJDu7LrPpT0L]]} …
google-cloud-platform kubernetes google-kubernetes-engine traefik
我需要配置 Keycloak,以便它创建一个 JWT,声明“sub”填充了用户名,而不是 sub 中的默认 userId。
这意味着,而不是这个令牌:
{
"jti": "b1384883-9b59-4788-b09f-98b40b7e3c3b",
...
"sub": "fbdb4e4a-6e93-4b08-a1e7-0b7bd08520a6",
"preferred_username": "m123456"
}
Run Code Online (Sandbox Code Playgroud)
我需要收到:
{
"jti": "b1384883-9b59-4788-b09f-98b40b7e3c3b",
...
"sub": "m123456",
"preferred_username": "m123456"
}
Run Code Online (Sandbox Code Playgroud)
你能建议怎么做吗?
我尝试过用户名映射器,但它添加了第二个“子”声明,并且 jwt 无效。
我的 kubernetes 系统中有许多 pod,随机名称为 wordpress.xxx.xx。
这里是Pod列表
我想使用一个命令与kubectl cp另一个命令将文件从一个部署复制到所有 Pod。
就我而言,我不想使用卷,因为它们安装到已经隐藏该文件夹的现有内容的路径中。
请问该怎么做?
谢谢您的回答。
我已经v1.9.0在裸机服务器中使用kubeadm命令创建了一个主Kubernetes主集群。现在,我想再添加两个母版,并使其成为多母版。
是否可以转换为多主站配置?是否有可用于此类对话的文档?
我发现此链接Kops不确定相同的步骤是否也适用于其他环境。
https://github.com/kubernetes/kops/blob/master/docs/single-to-multi-master.md
谢谢SR