Module not found: Can't resolve 'fs'尝试从 GCP Storage 列出存储桶时出现错误。
import { Storage } from '@google-cloud/storage';
const googleCloud = new Storage({
keyFilename: '../../my-project-c1a44bf80be3.json',
projectId: 'my-project',
});
googleCloud.getBuckets().then((x: any) => console.log(x));
Run Code Online (Sandbox Code Playgroud)
my-project-c1a44bf80be3.json(从GCP下载)存在并且是项目级别
错误:
event - compiled successfully
event - build page: /
wait - compiling...
error - ./node_modules/@google-cloud/storage/build/src/file.js:24:0
Module not found: Can't resolve 'fs'
null
Could not find files for / in .next/build-manifest.json
event - compiled successfully
Run Code Online (Sandbox Code Playgroud)
使用googleapis时会出现相同的错误。但是,./node_modules/@google-cloud/storage/build/src/file.js:24:0它不是google-auth-library在googleapis.
添加使用yarn.
node.js npm google-cloud-storage google-cloud-platform google-apis-explorer
为什么我们不能以命令式的方式创建PV或PVC?
尝试使用创建命令,但它没有显示任何一个。
kubectl create --help
Available Commands:
clusterrole Create a ClusterRole.
clusterrolebinding Create a ClusterRoleBinding for a particular ClusterRole
configmap Create a configmap from a local file, directory or literal value
cronjob Create a cronjob with the specified name.
deployment Create a deployment with the specified name.
ingress Create an ingress with the specified name.
job Create a job with the specified name.
namespace Create a namespace with the specified name
poddisruptionbudget Create a pod disruption budget with the specified …Run Code Online (Sandbox Code Playgroud) kubernetes kubectl persistent-volumes persistent-volume-claims kubernetes-pvc
我正在尝试在具有只读文件系统的容器中托管一个网络应用程序。每当我尝试通过容器将根文件系统配置为只读时,SecurityContext我都会收到以下错误:
Ports: 80/TCP, 443/TCP
Host Ports: 0/TCP, 0/TCP
State: Terminated
Reason: Error
Exit Code: 137
Started: Thu, 23 Sep 2021 18:13:08 +0300
Finished: Thu, 23 Sep 2021 18:13:08 +0300
Ready: False
Run Code Online (Sandbox Code Playgroud)
我尝试使用 AppArmor 配置文件来实现相同的目标,如下所示:
profile parser-profile flags=(attach_disconnected) {
#include <abstractions/base>
...
deny /** wl,
...
Run Code Online (Sandbox Code Playgroud)
不幸的是结果是一样的。
我认为发生的情况是容器无法保存 Web 应用程序的文件并且失败。
在我的场景中,我将运行不受信任的代码,并且必须确保不允许用户访问文件系统。
关于我做错了什么以及如何实现只读文件系统有什么想法吗?
我正在使用 AKS,下面是我的部署配置:
apiVersion: v1
kind: Service
metadata:
name: parser-service
spec:
selector:
app: parser
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
- port: 443
targetPort: …Run Code Online (Sandbox Code Playgroud) 我在本地 Kubernetes 环境中运行带有 SQL Server 的 Ubuntu 容器,并在 Windows 笔记本电脑上使用 Docker Desktop。现在我尝试将C:\data\sql包含数据库文件的本地文件夹 ( ) 安装到 pod 中。为此,我在 Kubernetes 中配置了持久卷和持久卷声明,但它似乎没有正确安装。我没有看到错误或任何内容,但是当我使用docker exec -it并检查数据文件夹进入容器时,它是空的。我希望本地文件夹中的文件出现在已安装的文件夹“数据”中,但事实并非如此。
PV、PVC 或 pod 中是否配置错误?
这是我的 yaml 文件:
apiVersion: v1
kind: PersistentVolume
metadata:
name: dev-customer-db-pv
labels:
type: local
app: customer-db
chart: customer-db-0.1.0
release: dev
heritage: Helm
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /C/data/sql
Run Code Online (Sandbox Code Playgroud)
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: dev-customer-db-pvc
labels:
app: customer-db
chart: customer-db-0.1.0
release: dev
heritage: Helm
spec:
accessModes:
- ReadWriteOnce …Run Code Online (Sandbox Code Playgroud) 我正在使用 Kustomize 来管理同一集群的多个变体。我正在使用nameSuffix选项为我的所有资源添加后缀:
nameSuffix: -mysfx
Run Code Online (Sandbox Code Playgroud)
我的问题是一切正常,但仅将此后缀添加到一个服务资源会给我带来问题。我的问题是应用程序(Patroni)与必须调用的服务交互:
CLUSTER-NAME-config
Run Code Online (Sandbox Code Playgroud)
所以我想从nameSuffix. 我知道由于此功能的设计方式,这是不可能的。我在 StackOverflow 和网络上阅读了几篇文章。nameSuffix我知道我可以跳过对一类资源的使用。所以我尝试输入我的kustomization.yaml行:
configurations:
- kustomize-config/kustomize-config.yaml
Run Code Online (Sandbox Code Playgroud)
跳过所有服务资源。然后在文件中kustomize-config/kustomize-config.yaml
nameSuffix:
- path: metadata/name
apiVersion: v1
kind: Service
skip: true
Run Code Online (Sandbox Code Playgroud)
但这行不通。
有谁知道这个配置有什么问题吗?
然后假设我现在可以跳过nameSuffix仅使用服务资源,我还有其他两个服务要添加此后缀。我需要做什么才能添加nameSuffix到这两项服务而不是上面提到的服务?
如果对此有更好的解决方案,请告诉我。
这是来自Kubernetes 文档:
一致且高度可用的键值存储用作 Kubernetes 所有集群数据的后备存储。
Kubernetes 内部是否有单独的机制来使 ETCD 更可用?或者 ETCD 是否使用 Raft 的修改版本来实现这种超能力?
我使用的是 Prometheus 2.33 版本。以下查询不起作用。
kubelet_volume_stats_available_bytes
kubelet_volume_stats_capacity_bytes
以下查询用于监控POD的DISK使用情况。
容器文件系统使用字节数
容器文件系统限制字节数
有没有办法获取PVC的使用量、限制值?
我使用 Google Cloud Build 和 kaniko 缓存来提高速度。直到最近,如果工作得很好,但现在却失败了
ERROR: build step 2 "gcr.io/kaniko-project/executor:latest" failed: step exited with non-zero status: 137
Run Code Online (Sandbox Code Playgroud)
我认为,这是因为构建器内存不足
有没有办法为此选择更高级别的虚拟机或增加内存?
我使用的是此处描述的相同标准配置。
提前致谢
Ps 常规构建gcr.io/cloud-builders/docker正在经历
我正在 OpenShift 上运行我的部署,发现我需要 GID 2121 才能具有写入权限。
当我尝试这样做时,我似乎仍然没有写访问权限:
security:
podSecurityContext:
fsGroup: 2121
Run Code Online (Sandbox Code Playgroud)
这给了我一个2121 is not an allowed group错误。
然而,这似乎对我有用:
security:
podSecurityContext:
fsGroup: 100010000 # original fsGroup value
supplementalGroups: [2121]
Run Code Online (Sandbox Code Playgroud)
fsGroup我想知道和 的区别supplementalGroups是什么。
我已阅读此处的文档并查看了kubectl explain deployment.spec.template.spec.securityContext,但我仍然不太明白其中的区别。
我能否澄清一下不同的用例是什么?
kubernetes ×8
azure-aks ×1
cap-theorem ×1
etcd ×1
kaniko ×1
kubectl ×1
kustomize ×1
node.js ×1
npm ×1
openshift ×1
prometheus ×1
raft ×1
readonly ×1