我已经用命令启动了pods
$ kubectl run busybox --image=busybox --restart=Never --tty -i --generator=run-pod/v1
Run Code Online (Sandbox Code Playgroud)
出了点问题,现在我无法删除这个pod我尝试使用下面的方法,但它不断重建自己
$ kubectl delete pods busybox-na3tm
pod "busybox-na3tm" deleted
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
busybox-vlzh3 0/1 ContainerCreating 0 14s
$ kubectl delete pod busybox-vlzh3 --grace-period=0
$ kubectl delete pods --all
pod "busybox-131cq" deleted
pod "busybox-136x9" deleted
pod "busybox-13f8a" deleted
pod "busybox-13svg" deleted
pod "busybox-1465m" deleted
pod "busybox-14uz1" deleted
pod "busybox-15raj" deleted
pod "busybox-160to" deleted
pod "busybox-16191" deleted
$ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS …Run Code Online (Sandbox Code Playgroud) 有没有办法使用Cloud SDK或列出存储在Google Cloud Storage 存储桶(或存储桶中的目录)中的所有对象的所有公共链接? gsutilgcloud
就像是:
$ gsutil ls --public-link gs://my-bucket/a-directory
我有一个在GKE上运行的postgres容器和一个用于存储数据的设置。但是,如果集群重新启动或删除,数据库中的所有数据都会丢失。PodPersistentVolumePod
如果我运行kubectl delete <postgres_pod>删除现有Pod并检查新创建的(由kubernetes)Pod替换已删除的数据库,则相应的数据库没有Pod删除之前的数据。
这是我用来部署postgres的yaml文件。
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: custom-storage
parameters:
type: pd-standard
provisioner: kubernetes.io/gce-pd
reclaimPolicy: Retain
volumeBindingMode: Immediate
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgres-volume-claim
spec:
storageClassName: custom-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
Run Code Online (Sandbox Code Playgroud)
部署.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers: …Run Code Online (Sandbox Code Playgroud) persistent-storage docker kubernetes google-kubernetes-engine
我面临的问题是 Cloud Storage 按字典顺序(字母顺序)对新添加的文件进行排序,而我正在使用 Cloud Functions 中的 Python 客户端库读取 Cloud Storage 存储桶中索引 0 处的文件(必须使用云函数作为我项目的一部分)并将数据放在 BigQuery 中,这对我来说很好用,但新添加的文件并不总是出现在索引 0 处。
流文件每天在不同时间进入我的存储桶。文件名相同(data-2019-10-18T14_20_00.000Z-2019-10-18T14_25_00.txt)但文件名中的日期和时间字段在每个新添加的文件中都不同。
每次触发云功能时,如何调整此python代码以读取Cloud Storage存储桶中最新添加的文件?
files = bucket.list_blobs()
fileList = [file.name for file in files if '.' in file.name]
blob = bucket.blob(fileList[0]) #reading file placed at index 0 in bucket
Run Code Online (Sandbox Code Playgroud) python client-library google-cloud-storage google-cloud-platform google-cloud-functions