我有一些正在运行的 kubernetes 集群,它可能会产生大量日志。Kubernetes 运行在 docker 之上,所以我想我需要配置 dockerd 来推出日志。
我找到了一些 dockerd 日志驱动程序的设置:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10k",
"max-file": "2"
}
}
Run Code Online (Sandbox Code Playgroud)
在 docker 服务重启的情况下,更改成功应用。
du /var/lib/docker/containers/container_hash/container_hash* -h
Run Code Online (Sandbox Code Playgroud)
显示按适当大小分块的日志文件。
但我不想重新启动守护进程,所以尝试重新加载配置:
sudo kill -SIGHUP $(pidof dockerd)
Run Code Online (Sandbox Code Playgroud)
在系统日志中我发现:
Mar 12 15:38:16 kso-gl dockerd[5331]: time="2018-03-12T15:38:16.446894155+02:00" level=info msg="Got signal to reload configuration, reloading fr
om: /etc/docker/daemon.json"
Run Code Online (Sandbox Code Playgroud)
所以,我假设配置已重新加载。不幸的是它没有效果。即使是新的容器。看起来与日志驱动程序相关的子系统忽略了配置重新加载。
我正在编写一个 shell 脚本,如果尚未安装,它应该安装一个工件。
它存在吗mvn install:check artifact-name?
我正在使用:Apache Maven 3.3.9
我正在尝试将网络插件从 flannel 切换到其他东西,仅用于教育目的。
法兰绒是通过以下方式安装的:
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Run Code Online (Sandbox Code Playgroud)
所以为了去除它我正在尝试
kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Run Code Online (Sandbox Code Playgroud)
结果我得到了:
k8s@k8s-master:~$ kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": clusterroles.rbac.authorization.k8s.io "flannel" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": clusterrolebindings.rbac.authorization.k8s.io "flannel" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": serviceaccounts "flannel" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": configmaps "kube-flannel-cfg" not found
error when stopping "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": timed out waiting for the condition
Run Code Online (Sandbox Code Playgroud)
这很奇怪,因为几个小时前我已经用编织做了这样的操作并且工作得很好。
通常对于文件上传,我使用了 multipart/form-data 并且效果很好。但现在我的服务器需要能够接受文件 application/octet-stream。
在服务器端我有:
@ResponseBody
@RequestMapping(path = "/mock",
consumes = { MediaType.APPLICATION_OCTET_STREAM_VALUE },
method = RequestMethod.POST)
public ResponseEntity handleFileUpload(@RequestParam("file") MultipartFile file) {
return ResponseEntity.accepted().build();
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试用curl 测试它:
curl -v -H "Content-Type:application/octet-stream" \
--data-binary @/home/user/Desktop/test.txt http://localhost:9090/mock
Run Code Online (Sandbox Code Playgroud)
结果有:
org.springframework.web.multipart.MultipartException: Current request is not a multipart request
Run Code Online (Sandbox Code Playgroud)
我注意到“文件”部分没有在我的curl 命令中指定,但在服务器端是预期的。目前尚不清楚下一步该移动到哪里以及测试命令或服务器或两者都损坏了。
我正在配置 spring cloud api gateway 以支持多个安全链。为此,我使用了几个安全过滤器链,它们在特定安全标头存在时触发:
如果我调整当前设置以在授权标头存在时触发第二个 (idp) 链(并使用 IDP 令牌进行调用),则一切正常。通过这种方式,安全链根据 idp jwk 验证授权标头中期望的令牌。但此标头已保留用于旧版身份验证。
我想我需要一种方法来指向 spring 资源服务器链寻找新的标头名称。
我的安全依赖项:
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
Run Code Online (Sandbox Code Playgroud)
我的配置
@EnableWebFluxSecurity
public class WebSecurityConfiguration {
// ...
@Bean
@Order(1)
public SecurityWebFilterChain iamAuthFilterChain(ServerHttpSecurity http) {
ServerWebExchangeMatcher matcher = exchange -> {
HttpHeaders headers = exchange.getRequest().getHeaders();
List<String> strings = headers.get(SurpriseHeaders.IDP_AUTH_TOKEN_HEADER_NAME);
return strings != null && strings.size() > 0
? MatchResult.match() : MatchResult.notMatch();
};
http
.securityMatcher(matcher)
.csrf().disable()
.authorizeExchange()
.pathMatchers(navigationService.getAuthFreeEndpoints()).permitAll()
.anyExchange().authenticated()
.and()
.oauth2ResourceServer(OAuth2ResourceServerSpec::jwt)
.oauth2ResourceServer().jwt().jwkSetUri(getJwkUri())
.and()
.and()
.addFilterAt(new …Run Code Online (Sandbox Code Playgroud) spring-security spring-security-oauth2 spring-oauth2 api-gateway
kubernetes ×2
api-gateway ×1
build-tools ×1
curl ×1
docker ×1
file-upload ×1
logging ×1
maven ×1
multipart ×1
networking ×1
spring-mvc ×1