OPA Gatekeeper:Kubernetes的策略和管理
一.系统环境
本文主要基于Kubernetes1.22.2和Linux操作系统Ubuntu 18.04。
| 服务器版本 | docker软件版本 | Kubernetes(k8s)集群版本 | CPU架构 |
|---|---|---|---|
| Ubuntu 18.04.5 LTS | Docker version 20.10.14 | v1.22.2 | x86_64 |
Kubernetes集群架构:k8scludes1作为master节点,k8scludes2,k8scludes3作为worker节点。
| 服务器 | 操作系统版本 | CPU架构 | 进程 | 功能描述 |
|---|---|---|---|---|
| k8scludes1/192.168.110.128 | Ubuntu 18.04.5 LTS | x86_64 | docker,kube-apiserver,etcd,kube-scheduler,kube-controller-manager,kubelet,kube-proxy,coredns,calico | k8s master节点 |
| k8scludes2/192.168.110.129 | Ubuntu 18.04.5 LTS | x86_64 | docker,kubelet,kube-proxy,calico | k8s worker节点 |
| k8scludes3/192.168.110.130 | Ubuntu 18.04.5 LTS | x86_64 | docker,kubelet,kube-proxy,calico | k8s worker节点 |
二.前言
随着云计算和容器技术的普及,Kubernetes已经成为现代应用程序部署和运维的事实标准。然而,随着集群规模的扩大和权限的分散,如何保证集群的安全性和合规性成为了一个亟待解决的问题。OPA Gatekeeper作为Open Policy Agent在Kubernetes上的一个插件,为Kubernetes集群提供了强大的策略治理能力。
使用OPA Gatekeeper的前提是已经有一套可以正常运行的Kubernetes集群,关于Kubernetes(k8s)集群的安装部署,可以查看博客《Ubuntu 安装部署Kubernetes(k8s)集群》https://www.cnblogs.com/renshengdezheli/p/17632858.html。
三.OPA Gatekeeper简介
OPA Gatekeeper是一个开源项目,它将Open Policy Agent(开放策略代理)集成到Kubernetes中,以实现细粒度的策略控制。OPA是一个通用的策略引擎,可以评估策略并做出决策,这些策略定义了哪些资源可以被访问以及如何访问。通过将OPA集成到Kubernetes中,我们可以充分利用Kubernetes的资源管理能力和OPA的策略治理能力,构建一个既安全又灵活的云原生应用环境。
请求通过认证和鉴权之后、被持久化为 Kubernetes 中的对象之前,Kubernetes 允许通过 admission controller webhooks 将策略决策与 API 服务器分离,从而拦截这些请求。Gatekeeper 创建的目的是使用户能够通过配置(而不是代码)自定义控制许可,并使用户了解集群的状态,而不仅仅是针对评估状态的单个对象,在这些对象准许加入的时候。
docker也可以使用Open Policy Agent(OPA)进行访问控制,详细操作请查看博客《docker使用Open Policy Agent(OPA)进行访问控制》。
四.在kubernetes上安装OPA Gatekeeper
创建目录存放文件。
root@k8scludes1:~# mkdir gatekeeper
root@k8scludes1:~# cd gatekeeper/
OPA Gatekeeper安装官网为:https://open-policy-agent.github.io/gatekeeper/website/docs/install/ 。
下载gatekeeper的安装yaml文件。
root@k8scludes1:~/gatekeeper# wget https://raw.githubusercontent.com/open-policy-agent/gatekeeper/release-3.8/deploy/gatekeeper.yaml
root@k8scludes1:~/gatekeeper# ls
gatekeeper.yaml
查看部署gatekeeper所需的镜像。
root@k8scludes1:~/gatekeeper# grep image gatekeeper.yaml
image: openpolicyagent/gatekeeper:v3.8.1
imagePullPolicy: Always
image: openpolicyagent/gatekeeper:v3.8.1
imagePullPolicy: Always
在k8s的worker节点提前下载好gatekeeper:v3.8.1镜像。
root@k8scludes2:~# docker pull openpolicyagent/gatekeeper:v3.8.1
root@k8scludes2:~# docker images | grep gatekeeper
openpolicyagent/gatekeeper v3.8.1 b14dbfb1e27a 3 weeks ago 70.3MB
root@k8scludes3:~# docker pull openpolicyagent/gatekeeper:v3.8.1
root@k8scludes3:~# docker images | grep gatekeeper
openpolicyagent/gatekeeper v3.8.1 b14dbfb1e27a 3 weeks ago 70.3MB
修改镜像下载策略为IfNotPresent。
root@k8scludes1:~/gatekeeper# vim gatekeeper.yaml
root@k8scludes1:~/gatekeeper# grep image gatekeeper.yaml
image: openpolicyagent/gatekeeper:v3.8.1
imagePullPolicy: IfNotPresent
image: openpolicyagent/gatekeeper:v3.8.1
imagePullPolicy: IfNotPresent
在Kubernetes 中一切都可视为资源,Kubernetes 1.7 之后增加了对 CRD 自定义资源二次开发能力来扩展 Kubernetes API,通过 CRD 我们可以向 Kubernetes API 中增加新资源类型,而不需要修改 Kubernetes 源码来创建自定义的 API server,该功能大大提高了 Kubernetes 的扩展能力。当你创建一个新的CustomResourceDefinition (CRD)时,Kubernetes API服务器将为你指定的每个版本创建一个新的RESTful资源路径,我们可以根据该api路径来创建一些我们自己定义的类型资源。CRD可以是命名空间的,也可以是集群范围的,由CRD的作用域(scpoe)字段中所指定的,与现有的内置对象一样,删除命名空间将删除该名称空间中的所有自定义对象,CRD是全局生效的。
查看crd。
root@k8scludes1:~/gatekeeper# kubectl get crd
NAME CREATED AT
bgpconfigurations.crd.projectcalico.org 2022-04-16T18:41:13Z
bgppeers.crd.projectcalico.org 2022-04-16T18:41:13Z
......
ipreservations.crd.projectcalico.org 2022-04-16T18:41:13Z
issuers.cert-manager.io 2022-04-24T17:07:46Z
kubecontrollersconfigurations.crd.projectcalico.org 2022-04-16T18:41:13Z
networkpolicies.crd.projectcalico.org 2022-04-16T18:41:13Z
networksets.crd.projectcalico.org 2022-04-16T18:41:13Z
orders.acme.cert-manager.io 2022-04-24T17:07:46Z
现在还没有gatekeeper的crd资源。
root@k8scludes1:~/gatekeeper# kubectl get crd | grep gatekeeper
部署gatekeeper。
root@k8scludes1:~/gatekeeper# kubectl apply -f gatekeeper.yaml
namespace/gatekeeper-system created
resourcequota/gatekeeper-critical-pods created
customresourcedefinition.apiextensions.k8s.io/assign.mutations.gatekeeper.sh created
customresourcedefinition.apiextensions.k8s.io/assignmetadata.mutations.gatekeeper.sh created
customresourcedefinition.apiextensions.k8s.io/configs.config.gatekeeper.sh created
......
Warning: policy/v1beta1 PodDisruptionBudget is deprecated in v1.21+, unavailable in v1.25+; use policy/v1 PodDisruptionBudget
poddisruptionbudget.policy/gatekeeper-controller-manager created
mutatingwebhookconfiguration.admissionregistration.k8s.io/gatekeeper-mutating-webhook-configuration created
validatingwebhookconfiguration.admissionregistration.k8s.io/gatekeeper-validating-webhook-configuration created
gatekeeper安装好之后,会创建相关的crd资源。
root@k8scludes1:~/gatekeeper# kubectl get crd | grep gatekeeper
assign.mutations.gatekeeper.sh 2022-05-30T04:07:59Z
assignmetadata.mutations.gatekeeper.sh 2022-05-30T04:07:59Z
configs.config.gatekeeper.sh 2022-05-30T04:07:59Z
constraintpodstatuses.status.gatekeeper.sh 2022-05-30T04:07:59Z
constrainttemplatepodstatuses.status.gatekeeper.sh 2022-05-30T04:07:59Z
constrainttemplates.templates.gatekeeper.sh 2022-05-30T04:07:59Z
modifyset.mutations.gatekeeper.sh 2022-05-30T04:08:00Z
mutatorpodstatuses.status.gatekeeper.sh 2022-05-30T04:08:00Z
providers.externaldata.gatekeeper.sh 2022-05-30T04:08:00Z
五.gatekeeper规则
5.1 使用gatekeeper禁止某些网站的镜像创建pod
在k8s里安装好gatekeeper之后,需要定义一系列的规则,gatekeeper-tmp.yaml表示创建一个名为BlacklistImages的crd模板,通过CRD自定义了一个资源类型 BlacklistImages,并定义了规则:“前缀为docker-fake.io/和google-gcr-fake.com/的镜像创建不了pod”。
root@k8scludes1:~/gatekeeper# vim gatekeeper-tmp.yaml
root@k8scludes1:~/gatekeeper# cat gatekeeper-tmp.yaml
apiVersion: templates.gatekeeper.sh/v1beta1
kind: ConstraintTemplate
metadata:
name: blacklistimages
spec:
crd:
spec:
names:
kind: BlacklistImages
targets:
- rego: |
package k8strustedimages
images {
image := input.review.object.spec.containers[_].image
#镜像不以docker-fake.io/和google-gcr-fake.com/开头
not startswith(image, "docker-fake.io/")
not startswith(image, "google-gcr-fake.com/")
}
#当出现以docker-fake.io/和google-gcr-fake.com/开头的镜像,则禁止并输出"not trusted image!"
violation[{"msg": msg}] {
not images
msg := "not trusted image!"
}
target: admission.k8s.gatekeeper.sh
创建自定义资源类型BlacklistImages。
root@k8scludes1:~/gatekeeper# kubectl apply -f gatekeeper-tmp.yaml
constrainttemplate.templates.gatekeeper.sh/blacklistimages created
root@k8scludes1:~/gatekeeper# kubectl get crd | grep blacklistimages
blacklistimages.constraints.gatekeeper.sh 2022-05-30T08:18:21Z
利用自定义资源类型BlacklistImages创建一个实例,指定用于哪个资源(pod/deploy/job)。
root@k8scludes1:~/gatekeeper# vim gatekeeper-blacklist.yaml
root@k8scludes1:~/gatekeeper# cat gatekeeper-blacklist.yaml
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: BlacklistImages
metadata:
generation: 1
managedFields:
name: pod-trusted-images
resourceVersion: "14449"
spec:
match:
kinds:
- apiGroups:
- ""
#表示自定义资源类型BlacklistImages用于pod
kinds:
- Pod
创建实例,pod-trusted-images就是自定义资源类型BlacklistImages的实例。
root@k8scludes1:~/gatekeeper# kubectl get BlacklistImages
No resources found
root@k8scludes1:~/gatekeeper# kubectl apply -f gatekeeper-blacklist.yaml
blacklistimages.constraints.gatekeeper.sh/pod-trusted-images created
root@k8scludes1:~/gatekeeper# kubectl get BlacklistImages
NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS
pod-trusted-images
编辑pod配置文件,表示使用hub.c.163.com/library/nginx:latest镜像创建一个pod。
root@k8scludes1:~/gatekeeper# vim pod.yaml
root@k8scludes1:~/gatekeeper# cat pod.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: podtest
name: podtest
spec:
terminationGracePeriodSeconds: 0
containers:
- image: hub.c.163.com/library/nginx:latest
imagePullPolicy: IfNotPresent
name: podtest
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
因为镜像名符合Gatekeeper规则,pod创建成功。
root@k8scludes1:~/gatekeeper# kubectl apply -f pod.yaml
pod/podtest created
root@k8scludes1:~/gatekeeper# kubectl get pod
NAME READY STATUS RESTARTS AGE
podtest 1/1 Running 0 9s
删除pod。
root@k8scludes1:~/gatekeeper# kubectl delete pod podtest
pod "podtest" deleted
在k8s的worker节点给hub.c.163.com/library/nginx:latest进行打标签重命名。
root@k8scludes2:~# docker tag hub.c.163.com/library/nginx:latest docker-fake.io/library/nginx:1.12.5
root@k8scludes2:~# docker tag hub.c.163.com/library/nginx:latest google-gcr-fake.com/library/nginx:1.12.5
root@k8scludes2:~# docker images | grep nginx
docker-fake.io/library/nginx 1.12.5 46102226f2fd 5 years ago 109MB
google-gcr-fake.com/library/nginx 1.12.5 46102226f2fd 5 years ago 109MB
hub.c.163.com/library/nginx latest 46102226f2fd 5 years ago 109MB
root@k8scludes3:~# docker tag hub.c.163.com/library/nginx:latest docker-fake.io/library/nginx:1.12.5
root@k8scludes3:~# docker tag hub.c.163.com/library/nginx:latest google-gcr-fake.com/library/nginx:1.12.5
root@k8scludes3:~# docker images | grep nginx
docker-fake.io/library/nginx 1.12.5 46102226f2fd 5 years ago 109MB
google-gcr-fake.com/library/nginx 1.12.5 46102226f2fd 5 years ago 109MB
hub.c.163.com/library/nginx latest 46102226f2fd 5 years ago 109MB
编辑pod配置文件,表示使用docker-fake.io/library/nginx:1.12.5镜像创建pod。
root@k8scludes1:~/gatekeeper# vim pod.yaml
root@k8scludes1:~/gatekeeper# cat pod.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: podtest
name: podtest
spec:
terminationGracePeriodSeconds: 0
containers:
- image: docker-fake.io/library/nginx:1.12.5
imagePullPolicy: IfNotPresent
name: podtest
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
创建pod失败,镜像不符合gatekeeper规则,[pod-trusted-images] not trusted image!。
root@k8scludes1:~/gatekeeper# kubectl apply -f pod.yaml
Error from server (Forbidden): error when creating "pod.yaml": admission webhook "validation.gatekeeper.sh" denied the request: [pod-trusted-images] not trusted image!
这次使用google-gcr-fake.com/library/nginx:1.12.5镜像创建pod,可以发现,因为BlacklistImages定义了规则:“前缀为docker-fake.io/和google-gcr-fake.com/的镜像创建不了pod”,使用docker-fake.io/library/nginx:1.12.5镜像和google-gcr-fake.com/library/nginx:1.12.5镜像创建不了pod。
root@k8scludes1:~/gatekeeper# vim pod.yaml
root@k8scludes1:~/gatekeeper# grep image: pod.yaml
- image: google-gcr-fake.com/library/nginx:1.12.5
root@k8scludes1:~/gatekeeper# kubectl apply -f pod.yaml
Error from server (Forbidden): error when creating "pod.yaml": admission webhook "validation.gatekeeper.sh" denied the request: [pod-trusted-images] not trusted image!
5.2 使用gatekeeper禁止创建LoadBalancer类型的Services服务
aa-tmp.yaml文件表示创建一个名为LBTypeSvcNotAllowed的CRD模板,通过CRD自定义了一个资源类型LBTypeSvcNotAllowed,并定义了规则:“禁止创建LoadBalancer类型的Services服务”。
root@k8scludes1:~/gatekeeper# vim aa-tmp.yaml
root@k8scludes1:~/gatekeeper# cat aa-tmp.yaml
apiVersion: templates.gatekeeper.sh/v1beta1
kind: ConstraintTemplate
metadata:
name: lbtypesvcnotallowed
spec:
crd:
spec:
names:
kind: LBTypeSvcNotAllowed
#listKind: LBTypeSvcNotAllowedList
#plural: lbtypesvcnotallowed
#singular: lbtypesvcnotallowed
targets:
- target: admission.k8s.gatekeeper.sh
rego: |
package kubernetes.admission
violation[{"msg": msg}] {
input.review.kind.kind = "Service"
input.review.operation = "CREATE"
input.review.object.spec.type = "LoadBalancer"
msg := "LoadBalancer Services are not permitted"
}
创建自定义资源类型LBTypeSvcNotAllowed。
root@k8scludes1:~/gatekeeper# kubectl apply -f aa-tmp.yaml
constrainttemplate.templates.gatekeeper.sh/lbtypesvcnotallowed created
root@k8scludes1:~/gatekeeper# kubectl get LBTypeSvcNotAllowed
No resources found
root@k8scludes1:~/gatekeeper# kubectl get crd | grep lbtypesvcnotallowed
lbtypesvcnotallowed.constraints.gatekeeper.sh 2022-05-30T09:14:53Z
利用自定义资源类型LBTypeSvcNotAllowed创建一个实例,bb-contraint.yaml表示把自定义资源LBTypeSvcNotAllowed应用于bb命名空间的Service上。
root@k8scludes1:~/gatekeeper# vim bb-contraint.yaml
root@k8scludes1:~/gatekeeper# cat bb-contraint.yaml
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: LBTypeSvcNotAllowed
metadata:
name: deny-lb-type-svc-dev-ns
spec:
match:
kinds:
- apiGroups: [""]
kinds: ["Service"]
namespaces:
- "bb"
创建实例,deny-lb-type-svc-dev-ns就是自定义资源类型LBTypeSvcNotAllowed的实例。
root@k8scludes1:~/gatekeeper# kubectl apply -f bb-contraint.yaml
lbtypesvcnotallowed.constraints.gatekeeper.sh/deny-lb-type-svc-dev-ns created
root@k8scludes1:~/gatekeeper# kubectl get LBTypeSvcNotAllowed
NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS
deny-lb-type-svc-dev-ns 0
创建bb命名空间。
root@k8scludes1:~/gatekeeper# kubectl create ns bb
namespace/bb created
root@k8scludes1:~/gatekeeper# kubectl get pod -n bb
No resources found in bb namespace.
编辑pod配置文件,表示使用nginx创建pod。
root@k8scludes1:~/gatekeeper# vim pod.yaml
root@k8scludes1:~/gatekeeper# cat pod.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: podtest
name: podtest
spec:
terminationGracePeriodSeconds: 0
containers:
- image: hub.c.163.com/library/nginx:latest
imagePullPolicy: IfNotPresent
name: podtest
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
使用hub.c.163.com/library/nginx:latest镜像在bb命名空间创建pod。
root@k8scludes1:~/gatekeeper# kubectl apply -f pod.yaml -n bb
pod/podtest created
root@k8scludes1:~/gatekeeper# kubectl get pod -n bb
NAME READY STATUS RESTARTS AGE
podtest 1/1 Running 0 18s
ClusterIP类型的svc创建成功。关于svc的详细操作,请查看博客《Kubernetes(k8s)服务service:service的发现和service的发布》。
root@k8scludes1:~/gatekeeper# kubectl expose --name=bb-nginxsvc pod podtest -n bb --port=80
service/bb-nginxsvc exposed
root@k8scludes1:~/gatekeeper# kubectl get svc -n bb
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
bb-nginxsvc ClusterIP 10.109.160.157 <none> 80/TCP 7s
删除SVC。
root@k8scludes1:~/gatekeeper# kubectl delete svc bb-nginxsvc -n bb
service "bb-nginxsvc" deleted
NodePort类型的svc创建成功。
root@k8scludes1:~/gatekeeper# kubectl expose pod podtest --name=bb-nginxsvc --port=80 -n bb --type=NodePort
service/bb-nginxsvc exposed
root@k8scludes1:~/gatekeeper# kubectl get svc -n bb
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
bb-nginxsvc NodePort 10.106.79.112 <none> 80:31311/TCP 21s
删除SVC。
root@k8scludes1:~/gatekeeper# kubectl delete svc bb-nginxsvc -n bb
service "bb-nginxsvc" deleted
因为不符合gatekeeper规则,LoadBalancer类型的svc不能创建,LoadBalancer Services are not permitted。
在bb命名空间,LoadBalancer类型的svc不能创建,其他类型的svc可以创建,在其他命名空间可以创建所有类型的svc。
root@k8scludes1:~/gatekeeper# kubectl expose pod podtest --name=bb-nginxsvc --port=80 -n bb --type=LoadBalancer
Error from server (Forbidden): admission webhook "validation.gatekeeper.sh" denied the request: [deny-lb-type-svc-dev-ns] LoadBalancer Services are not permitted
删除pod。
root@k8scludes1:~/gatekeeper# kubectl get all -n bb
NAME READY STATUS RESTARTS AGE
pod/podtest 1/1 Running 0 11m
root@k8scludes1:~/gatekeeper# kubectl delete pod podtest -n bb
pod "podtest" deleted
六.总结
OPA Gatekeeper为Kubernetes提供了强大的策略管理能力,使您能够实施自定义策略以控制资源访问。通过使用OPA Gatekeeper,您可以确保Kubernetes集群的安全性和合规性。
OPA Gatekeeper:Kubernetes的策略和管理的更多相关文章
- Kubernetes容器集群管理环境 - Prometheus监控篇
一.Prometheus介绍之前已经详细介绍了Kubernetes集群部署篇,今天这里重点说下Kubernetes监控方案-Prometheus+Grafana.Prometheus(普罗米修斯)是一 ...
- Kubernetes容器集群管理环境 - 完整部署(中篇)
接着Kubernetes容器集群管理环境 - 完整部署(上篇)继续往下部署: 八.部署master节点master节点的kube-apiserver.kube-scheduler 和 kube-con ...
- 阿里云上万个 Kubernetes 集群大规模管理实践
点击下载<不一样的 双11 技术:阿里巴巴经济体云原生实践> 本文节选自<不一样的 双11 技术:阿里巴巴经济体云原生实践>一书,点击上方图片即可下载! 作者 | 汤志敏,阿里 ...
- Kubernetes容器集群管理环境 - 完整部署(下篇)
在前一篇文章中详细介绍了Kubernetes容器集群管理环境 - 完整部署(中篇),这里继续记录下Kubernetes集群插件等部署过程: 十一.Kubernetes集群插件 插件是Kubernete ...
- 这些用来审计 Kubernetes RBAC 策略的方法你都见过吗?
原文链接:这些用来审计 Kubernetes RBAC 策略的方法你都见过吗? 认证与授权对任何安全系统来说都至关重要,Kubernetes 也不例外.即使我们不是安全工作人员,也需要了解我们的 Ku ...
- Kubernetes 使用 Kubevirt 运行管理 Windows 10 操作系统
原文链接:https://fuckcloudnative.io/posts/use-kubevirt-to-manage-windows-on-kubernetes/ 最近我发现我的 Kubernet ...
- Kubernetes 部署策略详解-转载学习
Kubernetes 部署策略详解 参考:https://www.qikqiak.com/post/k8s-deployment-strategies/ 在Kubernetes中有几种不同的方式发布应 ...
- 五、kubernetes节点与令牌管理
Kubernetes节点与令牌管理 一.令牌管理 查看令牌 [root@master ~]# kubeadm token list 删除令牌 [root@master ~]# kubeadm toke ...
- Kubernetes有状态应用管理——PetSet
目录贴:Kubernetes学习系列 1.介绍 在Kubernetes中,大多数的Pod管理都是基于无状态.一次性的理念.例如Replication Controller,它只是简单的保证可提供服务的 ...
- 基于kubernetes自研容器管理平台的技术实践
一.容器云的背景 伴随着微服务的架构的普及,结合开源的Dubbo和Spring Cloud等微服务框架,宜信内部很多业务线逐渐了从原来的单体架构逐渐转移到微服务架构.应用从有状态到无状态,具体来说将业 ...
随机推荐
- kolla-ansible部署OpenStack Train版技术方案
简单架构示意 项目目标 1. 实现容器化部署docker+ Ansible+openstack-tarin 2. 使用keeplived监控nova服务实现在单台服务器宕机的情况下能迅速切断连接减轻平 ...
- MySQL 分析查询与来源机器
当前分析针对版本:MariaDB 10.5 线上出现报错:can't create more than max_prepared_stmt_count statements.造成这个错误的直接原因就是 ...
- 大数据ETL开发之图解Kettle工具入门到精通(经典转载)
大数据ETL开发之图解Kettle工具(入门到精通) 置顶 袁袁袁袁满 文章目录 第0章 ETL简介 第1章 Kettle简介 1.1 Kettle是什么 1.2 Kettle的两种设计 1.3 Ke ...
- 【SQL】将日期时间转换成年月日的日期形式
[SQL]将日期时间转换成年月日的日期形式 这段时间写力扣的SQL题,发现了各式各样的转换时间的方法,正好记录一下 TO_CHAR(XXX,'YYYY-MM-DD') 这个在Oracle应该是很常用的 ...
- 力扣326(java)-3的幂(简单)
题目: 给定一个整数,写一个函数来判断它是否是 3 的幂次方.如果是,返回 true :否则,返回 false . 整数 n 是 3 的幂次方需满足:存在整数 x 使得 n == 3x 示例 1: 输 ...
- 轻松搭建基于 Serverless 的 ThinkPHP 应用
ThinkPHP 是什么? ThinkPHP 是一个免费开源的,快速.简单的面向对象的轻量级 PHP 开发框架,是为了敏捷 WEB 应用开发和简化企业应用开发而诞生的.ThinkPHP 从诞生以来一直 ...
- Apache Flink在 bilibili 的多元化探索与实践
简介: bilibili 万亿级传输分发架构的落地,以及 AI 领域如何基于 Flink 打造一套完善的预处理实时 Pipeline. 本文由 bilibili 大数据实时平台负责人郑志升分享,本次分 ...
- [PHP] Laravel 获取模型/表的所有字段
获取指定表的所有字段名: use Illuminate\Support\Facades\Schema; // 表名不带前缀 $columns = Schema::getColumnListing( ...
- Redisant Toolbox——面向开发者的多合一工具箱
Redisant Toolbox--面向开发者的多合一工具箱 Redisant Toolbox 拥有超过30种常用的开发工具:精心设计,快速.高效:离线使用,尊重您的隐私.官网地址:http://ww ...
- OLAP系列之分析型数据库clickhouse主从副本模式(三)
一.测试单分片,单副本或多副本模式 # 1.停止集群 systemctl stop clickhouse-server # 修改配置文件 vim /etc/clickhouse-server/conf ...