当前位置: 首页 > news >正文

OCP的operator——(4)用户任务:使用Operator创建etcd集群

文章目录

  • 环境
  • 在namespace中安装Operator
    • 先决条件
    • 使用Web console从OperatorHub安装
    • 删除
  • 使用CLI从OperatorHub安装
  • 从已安装的Operator创建应用
    • 使用Operator创建etcd集群
    • 报错
      • 从web console debug
      • 从命令行debug
      • 分析
  • 参考

环境

  • RHEL 9.3
  • Red Hat OpenShift Local 2.32

在namespace中安装Operator

先决条件

打开web console:

$ crc console
Opening the OpenShift Web Console in the default browser...

会自动打开浏览,访问web console:

在这里插入图片描述
注:如果不想自动打开浏览器,则可以加上 --url 选项:

$ crc console --url
https://console-openshift-console.apps-crc.testing

然后手工复制URL,并从浏览器里访问。

查看用户名密码:

$ crc console --credentials
To login as a regular user, run 'oc login -u developer -p developer https://api.crc.testing:6443'.
To login as an admin, run 'oc login -u kubeadmin -p cWwas-FvXBW-rTjsi-eECwX https://api.crc.testing:6443'

使用 developer 登录web console:

在这里插入图片描述

切换到“Administrator”视角,可见,在“Operators”下,只有“Installed Operators”(当前没有安装Operator)。

这是因为 developer 用户没有安装Operator的权限,需要赋权才行。

简略起见,就不赋权了。退出登录,然后使用 kubeadmin 帐号登录:

在这里插入图片描述

可见,在“Operators”下多了“OperatorHub”子菜单,并且“Installed Operators”里显示了“Package Server”。

使用Web console从OperatorHub安装

点击“OperatorHub”,搜索“etcd”:

在这里插入图片描述
点击搜索结果里的“etcd”,弹出对话框,如下:

在这里插入图片描述

点击左上角“Install”按钮,如下:

  • Update channel:默认为 singlenamespace-alpha
  • Version:默认为 0.9.4
  • Installation mode:默认为 A specific namespace on the cluster
  • Installed namespace:选择 my-etcd ,这是自己创建的project(namespace),若还没有创建,则创建一下
  • Update approval:默认为 Automatic

在这里插入图片描述

最后,点击“Install”按钮,安装Operator。

大约一两分钟,就安装好了:

在这里插入图片描述

回到“Installed Operators”,可见在 my-etec project下,出现了etcd Operator:

在这里插入图片描述

点击可以查看详情:

在这里插入图片描述

注:在命令行,可查看相应的CSV:

$ oc get csv -n my-etcd
NAME                  DISPLAY   VERSION   REPLACES              PHASE
etcdoperator.v0.9.4   etcd      0.9.4     etcdoperator.v0.9.2   Succeeded

删除

点击右侧三个点,选择“Uninstall Operator”:

在这里插入图片描述

使用CLI从OperatorHub安装

查看当前身份:

$ oc whoami
kubeadmin

查看OperatorHub中集群可用的Operator列表:

$ oc get packagemanifests -n openshift-marketplace
NAME                                               CATALOG               AGE
forklift-operator                                  Community Operators   34d
debezium-operator                                  Community Operators   34d
pcc-operator                                       Certified Operators   34d
......
etcd                                               Community Operators   34d
......

检查所需Operator,以验证其支持的安装模式和可用频道:

$ oc describe packagemanifests etcd -n openshift-marketplace
Name:         etcd
Namespace:    openshift-marketplace
Labels:       catalog=community-operatorscatalog-namespace=openshift-marketplaceoperatorframework.io/arch.amd64=supportedoperatorframework.io/os.linux=supportedprovider=CNCFprovider-url=
Annotations:  <none>
API Version:  packages.operators.coreos.com/v1
Kind:         PackageManifest
Metadata:Creation Timestamp:  2024-01-10T10:34:13Z
Spec:
Status:Catalog Source:               community-operatorsCatalog Source Display Name:  Community OperatorsCatalog Source Namespace:     openshift-marketplaceCatalog Source Publisher:     Red HatChannels:Current CSV:  etcdoperator.v0.6.1Current CSV Desc:Annotations:Capabilities:           Full LifecycleDescription:            etcd is a distributed key value store providing a reliable way to store data across a cluster of machines.Tectonic - Visibility:  ocsApiservicedefinitions:Customresourcedefinitions:Owned:Description:   Represents a cluster of etcd nodes.Display Name:  etcd ClusterKind:          EtcdClusterName:          etcdclusters.etcd.database.coreos.comVersion:       v1beta2Description:       etcd is a distributed key value store that provides a reliable way to store data across a cluster of machines. It’s open-source and available on GitHub. etcd gracefully handles leader elections during network partitions and will tolerate machine failure, including the leader. Your applications can read and write data into etcd.
A simple use-case is to store database connection details or feature flags within etcd as key value pairs. These values can be watched, allowing your app to reconfigure itself when they change. Advanced uses take advantage of the consistency guarantees to implement database leader elections or do distributed locking across a cluster of workers._The etcd Open Cloud Service is Public Alpha. The goal before Beta is to fully implement backup features._### Reading and writing to etcdCommunicate with etcd though its command line utility `etcdctl` or with the API using the automatically generated Kubernetes Service.[Read the complete guide to using the etcd Open Cloud Service](https://coreos.com/tectonic/docs/latest/alm/etcd-ocs.html)### Supported Features
**High availability**
Multiple instances of etcd are networked together and secured. Individual failures or networking issues are transparently handled to keep your cluster up and running.
**Automated updates**
Rolling out a new etcd version works like all Kubernetes rolling updates. Simply declare the desired version, and the etcd service starts a safe rolling update to the new version automatically.
**Backups included**
Coming soon, the ability to schedule backups to happen on or off cluster.Display Name:  etcdInstall Modes:Supported:  trueType:       OwnNamespaceSupported:  trueType:       SingleNamespaceSupported:  falseType:       MultiNamespaceSupported:  trueType:       AllNamespacesKeywords:etcdkey valuedatabasecoreosopen sourceLinks:Name:  BlogURL:   https://coreos.com/etcdName:  DocumentationURL:   https://coreos.com/operators/etcd/docs/latest/Name:  etcd Operator Source CodeURL:   https://github.com/coreos/etcd-operatorMaintainers:Email:   support@coreos.comName:    CoreOS, IncMaturity:  alphaProvider:Name:  CoreOS, IncRelated Images:quay.io/coreos/etcd-operator@sha256:bd944a211eaf8f31da5e6d69e8541e7cada8f16a9f7a5a570b22478997819943Version:  0.6.1Entries:Name:       etcdoperator.v0.6.1Version:    0.6.1Name:         alphaCurrent CSV:  etcdoperator.v0.9.4-clusterwideCurrent CSV Desc:Annotations:Alm - Examples:  [{"apiVersion": "etcd.database.coreos.com/v1beta2","kind": "EtcdCluster","metadata": {"name": "example","annotations": {"etcd.database.coreos.com/scope": "clusterwide"}},"spec": {"size": 3,"version": "3.2.13"}},{"apiVersion": "etcd.database.coreos.com/v1beta2","kind": "EtcdRestore","metadata": {"name": "example-etcd-cluster-restore"},"spec": {"etcdCluster": {"name": "example-etcd-cluster"},"backupStorageType": "S3","s3": {"path": "<full-s3-path>","awsSecret": "<aws-secret>"}}},{"apiVersion": "etcd.database.coreos.com/v1beta2","kind": "EtcdBackup","metadata": {"name": "example-etcd-cluster-backup"},"spec": {"etcdEndpoints": ["<etcd-cluster-endpoints>"],"storageType":"S3","s3": {"path": "<full-s3-path>","awsSecret": "<aws-secret>"}}}
]Capabilities:           Full LifecycleCategories:             DatabaseContainer Image:        quay.io/coreos/etcd-operator@sha256:66a37fd61a06a43969854ee6d3e21087a98b93838e284a6086b13917f96b0d9bCreated At:             2019-02-28 01:03:00Description:            Create and maintain highly-available etcd clusters on KubernetesRepository:             https://github.com/coreos/etcd-operatorTectonic - Visibility:  ocsApiservicedefinitions:Customresourcedefinitions:Owned:Description:   Represents a cluster of etcd nodes.Display Name:  etcd ClusterKind:          EtcdClusterName:          etcdclusters.etcd.database.coreos.comVersion:       v1beta2Description:   Represents the intent to backup an etcd cluster.Display Name:  etcd BackupKind:          EtcdBackupName:          etcdbackups.etcd.database.coreos.comVersion:       v1beta2Description:   Represents the intent to restore an etcd cluster from a backup.Display Name:  etcd RestoreKind:          EtcdRestoreName:          etcdrestores.etcd.database.coreos.comVersion:       v1beta2Description:       The etcd Operater creates and maintains highly-available etcd clusters on Kubernetes, allowing engineers to easily deploy and manage etcd clusters for their applications.etcd is a distributed key value store that provides a reliable way to store data across a cluster of machines. It’s open-source and available on GitHub. etcd gracefully handles leader elections during network partitions and will tolerate machine failure, including the leader.### Reading and writing to etcdCommunicate with etcd though its command line utility `etcdctl` via port forwarding:$ kubectl --namespace default port-forward service/example-client 2379:2379$ etcdctl --endpoints http://127.0.0.1:2379 get /Or directly to the API using the automatically generated Kubernetes Service:$ etcdctl --endpoints http://example-client.default.svc:2379 get /Be sure to secure your etcd cluster (see Common Configurations) before exposing it outside of the namespace or cluster.### Supported Features* **High availability** - Multiple instances of etcd are networked together and secured. Individual failures or networking issues are transparently handled to keep your cluster up and running.* **Automated updates** - Rolling out a new etcd version works like all Kubernetes rolling updates. Simply declare the desired version, and the etcd service starts a safe rolling update to the new version automatically.* **Backups included** - Create etcd backups and restore them through the etcd Operator.### Common Configurations* **Configure TLS** - Specify [static TLS certs](https://github.com/coreos/etcd-operator/blob/master/doc/user/cluster_tls.md) as Kubernetes secrets.* **Set Node Selector and Affinity** - [Spread your etcd Pods](https://github.com/coreos/etcd-operator/blob/master/doc/user/spec_examples.md#three-member-cluster-with-node-selector-and-anti-affinity-across-nodes) across Nodes and availability zones.* **Set Resource Limits** - [Set the Kubernetes limit and request](https://github.com/coreos/etcd-operator/blob/master/doc/user/spec_examples.md#three-member-cluster-with-resource-requirement) values for your etcd Pods.* **Customize Storage** - [Set a custom StorageClass](https://github.com/coreos/etcd-operator/blob/master/doc/user/spec_examples.md#custom-persistentvolumeclaim-definition) that you would like to use.Display Name:  etcdInstall Modes:Supported:  trueType:       OwnNamespaceSupported:  falseType:       SingleNamespaceSupported:  falseType:       MultiNamespaceSupported:  trueType:       AllNamespacesKeywords:etcdkey valuedatabasecoreosopen sourceLinks:Name:  BlogURL:   https://coreos.com/etcdName:  DocumentationURL:   https://coreos.com/operators/etcd/docs/latest/Name:  etcd Operator Source CodeURL:   https://github.com/coreos/etcd-operatorMaintainers:Email:   etcd-dev@googlegroups.comName:    etcd CommunityMaturity:  alphaProvider:Name:  CNCFRelated Images:quay.io/coreos/etcd-operator@sha256:66a37fd61a06a43969854ee6d3e21087a98b93838e284a6086b13917f96b0d9bVersion:  0.9.4-clusterwideEntries:Name:       etcdoperator.v0.9.4-clusterwideVersion:    0.9.4-clusterwideName:       etcdoperator.v0.9.2-clusterwideVersion:    0.9.2-clusterwideName:       etcdoperator.v0.9.0Version:    0.9.0Name:         clusterwide-alphaCurrent CSV:  etcdoperator.v0.9.4Current CSV Desc:Annotations:Alm - Examples:  [{"apiVersion": "etcd.database.coreos.com/v1beta2","kind": "EtcdCluster","metadata": {"name": "example"},"spec": {"size": 3,"version": "3.2.13"}},{"apiVersion": "etcd.database.coreos.com/v1beta2","kind": "EtcdRestore","metadata": {"name": "example-etcd-cluster-restore"},"spec": {"etcdCluster": {"name": "example-etcd-cluster"},"backupStorageType": "S3","s3": {"path": "<full-s3-path>","awsSecret": "<aws-secret>"}}},{"apiVersion": "etcd.database.coreos.com/v1beta2","kind": "EtcdBackup","metadata": {"name": "example-etcd-cluster-backup"},"spec": {"etcdEndpoints": ["<etcd-cluster-endpoints>"],"storageType":"S3","s3": {"path": "<full-s3-path>","awsSecret": "<aws-secret>"}}}
]Capabilities:           Full LifecycleCategories:             DatabaseContainer Image:        quay.io/coreos/etcd-operator@sha256:66a37fd61a06a43969854ee6d3e21087a98b93838e284a6086b13917f96b0d9bCreated At:             2019-02-28 01:03:00Description:            Create and maintain highly-available etcd clusters on KubernetesRepository:             https://github.com/coreos/etcd-operatorTectonic - Visibility:  ocsApiservicedefinitions:Customresourcedefinitions:Owned:Description:   Represents a cluster of etcd nodes.Display Name:  etcd ClusterKind:          EtcdClusterName:          etcdclusters.etcd.database.coreos.comVersion:       v1beta2Description:   Represents the intent to backup an etcd cluster.Display Name:  etcd BackupKind:          EtcdBackupName:          etcdbackups.etcd.database.coreos.comVersion:       v1beta2Description:   Represents the intent to restore an etcd cluster from a backup.Display Name:  etcd RestoreKind:          EtcdRestoreName:          etcdrestores.etcd.database.coreos.comVersion:       v1beta2Description:       The etcd Operater creates and maintains highly-available etcd clusters on Kubernetes, allowing engineers to easily deploy and manage etcd clusters for their applications.etcd is a distributed key value store that provides a reliable way to store data across a cluster of machines. It’s open-source and available on GitHub. etcd gracefully handles leader elections during network partitions and will tolerate machine failure, including the leader.### Reading and writing to etcdCommunicate with etcd though its command line utility `etcdctl` via port forwarding:$ kubectl --namespace default port-forward service/example-client 2379:2379$ etcdctl --endpoints http://127.0.0.1:2379 get /Or directly to the API using the automatically generated Kubernetes Service:$ etcdctl --endpoints http://example-client.default.svc:2379 get /Be sure to secure your etcd cluster (see Common Configurations) before exposing it outside of the namespace or cluster.### Supported Features* **High availability** - Multiple instances of etcd are networked together and secured. Individual failures or networking issues are transparently handled to keep your cluster up and running.* **Automated updates** - Rolling out a new etcd version works like all Kubernetes rolling updates. Simply declare the desired version, and the etcd service starts a safe rolling update to the new version automatically.* **Backups included** - Create etcd backups and restore them through the etcd Operator.### Common Configurations* **Configure TLS** - Specify [static TLS certs](https://github.com/coreos/etcd-operator/blob/master/doc/user/cluster_tls.md) as Kubernetes secrets.* **Set Node Selector and Affinity** - [Spread your etcd Pods](https://github.com/coreos/etcd-operator/blob/master/doc/user/spec_examples.md#three-member-cluster-with-node-selector-and-anti-affinity-across-nodes) across Nodes and availability zones.* **Set Resource Limits** - [Set the Kubernetes limit and request](https://github.com/coreos/etcd-operator/blob/master/doc/user/spec_examples.md#three-member-cluster-with-resource-requirement) values for your etcd Pods.* **Customize Storage** - [Set a custom StorageClass](https://github.com/coreos/etcd-operator/blob/master/doc/user/spec_examples.md#custom-persistentvolumeclaim-definition) that you would like to use.Display Name:  etcdInstall Modes:Supported:  trueType:       OwnNamespaceSupported:  trueType:       SingleNamespaceSupported:  falseType:       MultiNamespaceSupported:  falseType:       AllNamespacesKeywords:etcdkey valuedatabasecoreosopen sourceLinks:Name:  BlogURL:   https://coreos.com/etcdName:  DocumentationURL:   https://coreos.com/operators/etcd/docs/latest/Name:  etcd Operator Source CodeURL:   https://github.com/coreos/etcd-operatorMaintainers:Email:   etcd-dev@googlegroups.comName:    etcd CommunityMaturity:  alphaProvider:Name:  CNCFRelated Images:quay.io/coreos/etcd-operator@sha256:66a37fd61a06a43969854ee6d3e21087a98b93838e284a6086b13917f96b0d9bVersion:  0.9.4Entries:Name:         etcdoperator.v0.9.4Version:      0.9.4Name:         etcdoperator.v0.9.2Version:      0.9.2Name:         etcdoperator.v0.9.0Version:      0.9.0Name:           singlenamespace-alphaDefault Channel:  singlenamespace-alphaPackage Name:     etcdProvider:Name:  CNCF
Events:    <none>

OperatorGroup 对象定义的Operator组,选择目标namespace,在其中为同一namespace中的所有Operator生成所需的RBAC访问权限。

订阅Operator的namespace必须具有与Operator的安装模式( AllNamespacesSingleNamespace 模式)相匹配的Operator组。如果要使用 AllNamespaces 安装Operator,则 openshift-operators namespace已有适当的Operator组。

不过,如果采用 SingleNamespace 模式,而还没有适当的Operator组,则必须创建一个。

注意:前面在使用web console时,选择 SingleNamespace 模式,则在后台自动创建了 OperatorGroupSubscription 对象。

创建 OperatorGroup 对象YAML文件,比如 operatorgroup.yaml

apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:name: <operatorgroup_name>namespace: <namespace>
spec:targetNamespaces:- <namespace>
  • <operatorgroup_name>my-operatorgroup
  • <namespace>my-etcd

注意:OLM为每个Operator组创建以下集群角色:

  • <operatorgroup_name>-admin
  • <operatorgroup_name>-edit
  • <operatorgroup_name>-view

当手动创建Operator组时,必须指定一个唯一名称,该名称不能和现有集群角色或其它Operator组冲突。

创建 OperatorGroup 对象:

oc apply -f operatorgroup.yaml

创建一个 Subscription 对象YAML文件,为Operator订阅一个namespace,比如 sub.yaml

apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:name: <subscription_name># namespace: openshift-operators # 1namespace: my-etcd # 1
spec:channel: <channel_name> # 2name: <operator_name> # 3source: redhat-operators # 4sourceNamespace: openshift-marketplace # 5config:env: # 6- name: ARGSvalue: "-v=10"envFrom: # 7- secretRef:name: license-secretvolumes: # 8- name: <volume_name>configMap:name: <configmap_name>volumeMounts: # 9- mountPath: <directory_name>name: <volume_name>tolerations: # 10- operator: "Exists"resources: # 11requests:memory: "64Mi"cpu: "250m"limits:memory: "128Mi"cpu: "500m"nodeSelector: # 12foo: bar
  1. 对于默认的 AllNamespaces 安装模式用法,需指定 openshift-operators namespace。也可以指定一个自定义的全局namespace(如果创建了)。否则,需为 SingleNamespace 安装模式使用指定关联的单个namespace。

本例中,指定了 my-etcd namespace。

  • <subscription_name>etcd
  • <channel_name>singlenamespace-alpha
  • <operator_name>etcd
  • <volume_name>my-volume
  • <configmap_name>my-configmap
  • <directory_name>my-directory

如果集群为STS模式,在 Subscription 对象中包含以下字段:

kind: Subscription
# ...
spec:installPlanApproval: Manual # 1config:env:- name: ROLEARNvalue: "<role_arn>" # 2

创建 Subscription 对象:

oc apply -f sub.yaml

此时,OLM已能感知到所选的Operator。Operator的CSV应该已经出现在目标namespace中,由Operator所提供的API应该已经可用于创建。

注:文档说的不是很清楚,本例应该用不到ConfigMap、PVC、PV,这可能只是一个模板。我没有实际实验。

从已安装的Operator创建应用

使用Operator创建etcd集群

前面安装好etcd Operator后,在web console上点击etcd,查看详情。

Provided APIs 下,可见该Operator提供了三类新资源:

  • etcd Cluster
  • etcd Backup
  • etcd Restore

这些对象的工作方式与内建的原生Kubernetes对象(比如 DeploymentReplicaSet )相似,但包含管理etcd所特有的逻辑。

在这里插入图片描述

点击“etcd Cluster”下方的“Create instance”,如下:

在这里插入图片描述

点击左下角“Create”按钮,如下:

在这里插入图片描述

报错

点击“EC example”(EC表示EtcdCluster),然后查看Resources页签:

在这里插入图片描述
可以看到pod处于pending状态。

(注:上图是一个clusterwide的Operator,因为我重新安装过Operater,不过问题都是一样的。)

从web console debug

点击“example-bcqztbd6l6”pod,然后查看“Logs”页签:

在这里插入图片描述

可以看到,“etcd”容器没有任何log(因为它处于“waiting”状态)。切换到“check-dns”容器,可以看到其log:

在这里插入图片描述

可以看到,在不断的产生重复的log:

......
nslookup: can't resolve 'example-bcqztbd6l6.example.my-etcd.svc'
Server: 10.217.4.10
Address 1: 10.217.4.10 dns-default.openshift-dns.svc.cluster.local
......

从命令行debug

在命令行查看pod:

$ oc describe pod example-bcqztbd6l6 -n my-etcd
Name:             example-bcqztbd6l6
Namespace:        my-etcd
......
Init Containers:check-dns:Container ID:  cri-o://8e4f03cfea06f682d877e6122ebd84f4b6f8ae75f87ba0fd3ebae1fabd36ebbeImage:         busybox:1.28.0-glibcImage ID:      docker.io/library/busybox@sha256:0b55a30394294ab23b9afd58fab94e61a923f5834fba7ddbae7f8e0c11ba85e6Port:          <none>Host Port:     <none>Command:/bin/sh-cTIMEOUT_READY=0while ( ! nslookup example-bcqztbd6l6.example.my-etcd.svc )do# If TIMEOUT_READY is 0 we should never time out and exit TIMEOUT_READY=$(( TIMEOUT_READY-1 ))if [ $TIMEOUT_READY -eq 0 ];thenecho "Timed out waiting for DNS entry"exit 1fisleep 1doneState:          RunningStarted:      Wed, 14 Feb 2024 17:49:40 +0800Ready:          FalseRestart Count:  0Environment:    <none>Mounts:         <none>
Containers:etcd:Container ID:  Image:         quay.io/coreos/etcd:v3.2.13Image ID:      Ports:         2380/TCP, 2379/TCPHost Ports:    0/TCP, 0/TCPCommand:/usr/local/bin/etcd--data-dir=/var/etcd/data--name=example-bcqztbd6l6--initial-advertise-peer-urls=http://example-bcqztbd6l6.example.my-etcd.svc:2380--listen-peer-urls=http://0.0.0.0:2380--listen-client-urls=http://0.0.0.0:2379--advertise-client-urls=http://example-bcqztbd6l6.example.my-etcd.svc:2379--initial-cluster=example-bcqztbd6l6=http://example-bcqztbd6l6.example.my-etcd.svc:2380--initial-cluster-state=new--initial-cluster-token=a8f3fa08-f114-4c12-95b7-60e14eea400cState:          WaitingReason:       PodInitializingReady:          FalseRestart Count:  0Liveness:       exec [/bin/sh -ec ETCDCTL_API=3 etcdctl endpoint status] delay=10s timeout=10s period=60s #success=1 #failure=3Readiness:      exec [/bin/sh -ec ETCDCTL_API=3 etcdctl endpoint status] delay=1s timeout=5s period=5s #success=1 #failure=3Environment:    <none>Mounts:/var/etcd from etcd-data (rw)
Conditions:Type              StatusInitialized       False Ready             False ContainersReady   False PodScheduled      True 
......

可见,在 Init Containers: 处,其 Command 是一段脚本,包含了一个死循环,只要 nslookup example-bcqztbd6l6.example.my-etcd.svc 有问题(返回值不为0),就会一直循环下去。

在命令行查看log:

$ oc logs example-bcqztbd6l6 -n my-etcd
Defaulted container "etcd" out of: etcd, check-dns (init)
Error from server (BadRequest): container "etcd" in pod "example-bcqztbd6l6" is waiting to start: PodInitializing

说明pod里的 etcd 容器在等待pod初始化。

查看 etcd 容器的log:

$ oc logs example-bcqztbd6l6 -c etcd -n my-etcd
Error from server (BadRequest): container "etcd" in pod "example-bcqztbd6l6" is waiting to start: PodInitializing

只是说在等待pod初始化。从以上log看不出来pod卡在那里了,只能通过 describe pod 看到有段 Init Containers 逻辑,得知 check-dns 容器,然后查看其log:

$ oc logs example-bcqztbd6l6 -c check-dns -n my-etcd
......
nslookup: can't resolve 'example-bcqztbd6l6.example.my-etcd.svc'
Server:    10.217.4.10
Address 1: 10.217.4.10 dns-default.openshift-dns.svc.cluster.local
......

可见,和从web console看到的log是一致的。

分析

为什么会报这个错误呢?我在网上百度了一下,貌似这是 busybox 的一个bug。

参见 https://stackoverflow.com/questions/52109039/nslookup-cant-resolve-kubernetes-default ,里面提到:

You have encountered a bug in the latest versions of the busybox docker image. Use the tag busybox:1.28 instead of latest.

原issue: https://github.com/docker-library/busybox/issues/48

不过也可能是因为我使用的是Red Hat OpenShift Local。没有深究。

参考

  • https://access.redhat.com/documentation/en-us/openshift_container_platform/4.14/html-single/operators/index#user-tasks

相关文章:

OCP的operator——(4)用户任务:使用Operator创建etcd集群

文章目录 环境在namespace中安装Operator先决条件使用Web console从OperatorHub安装删除 使用CLI从OperatorHub安装从已安装的Operator创建应用使用Operator创建etcd集群报错从web console debug从命令行debug分析 参考 环境 RHEL 9.3Red Hat OpenShift Local 2.32 在namespa…...

win7自带截图工具保存失效解决办法

今日发现一台远航技术的win7中自带的截图工具使用时正常&#xff0c;保存图片时没有弹出保存位置的对话窗口&#xff0c;无法正常保存图片。解决方案如下&#xff1a; 1、进入注册表编辑器。开始-搜索程序和文件-输入 regedit 按下回车键&#xff0c;打开注册表&#xff1b; 2、…...

Android14之Android Rust模块编译语法(一百八十七)

简介&#xff1a; CSDN博客专家&#xff0c;专注Android/Linux系统&#xff0c;分享多mic语音方案、音视频、编解码等技术&#xff0c;与大家一起成长&#xff01; 优质专栏&#xff1a;Audio工程师进阶系列【原创干货持续更新中……】&#x1f680; 优质专栏&#xff1a;多媒…...

分布式文件系统 SpringBoot+FastDFS+Vue.js【三】

分布式文件系统 SpringBootFastDFSVue.js【三】 七、创建后台--分角色管理7.1.创建后台数据库表7.2.创建实体类7.2.1.Admin7.2.2.Menu7.2.3.MenuBean7.2.4.Role7.2.5.RoleMenu 7.3.编辑配置文件application.yml7.4.编写工具类7.4.1.AuthContextHolder7.4.2.HttpUtils7.4.3.Stri…...

【深度学习每日小知识】全景分割

全景分割 全景分割是一项计算机视觉任务&#xff0c;涉及将图像或视频分割成不同的对象及其各自的部分&#xff0c;并用相应的类别标记每个像素。与传统的语义分割相比&#xff0c;它是一种更全面的图像分割方法&#xff0c;传统的语义分割仅将图像划分为类别&#xff0c;而不…...

机器人能否返回原点

657. 机器人能否返回原点 在二维平面上&#xff0c;有一个机器人从原点 (0, 0) 开始。给出它的移动顺序&#xff0c;判断这个机器人在完成移动后是否在 (0, 0) 处结束。 移动顺序由字符串 moves 表示。字符 move[i] 表示其第 i 次移动。机器人的有效动作有 R&#xff08;右&a…...

Mysql5.6忘记密码,如何找回(windows)

mysql5.6安装 第一步&#xff1a;关闭正在运行的数据库服务 net stop mysql第二步&#xff1a;在my.ini文件当中的[mysqld] 任意一个位置放入 skip-grant-tables第三步&#xff1a;启动mysql服务 net start mysql第四步&#xff1a;服务启动成功后就可以登录了&#xff0c;…...

算法训练营day29, 贪心算法3

import ( "sort" ) // 1005. K 次取反后最大化的数组和 func largestSumAfterKNegations(nums []int, k int) int { //先从小到大排序 sort.Ints(nums) sum : 0 //将数组中负数转为正数 for i : 0; i < len(nums); i { if nums[i] < 0 && k > 0 …...

164基于matlab的奇异值分解、小波降噪、zoom细化

基于matlab的奇异值分解、小波降噪、zoom细化。程序已调通&#xff0c;可直接运行。 164 奇异值分解 小波降噪 zoom细化 (xiaohongshu.com)...

每日OJ题_算法_递归③力扣206. 反转链表

目录 力扣206. 反转链表 解析代码 力扣206. 反转链表 206. 反转链表 LCR 024. 反转链表 难度 简单 给你单链表的头节点 head &#xff0c;请你反转链表&#xff0c;并返回反转后的链表。 示例 1&#xff1a; 输入&#xff1a;head [1,2,3,4,5] 输出&#xff1a;[5,4,3,…...

【Linux】指令 【whereis】

whereis是一个用于查找特定文件在文件系统中的位置的命令。 主要查找二进制文件或帮助文件&#xff0c;适用于那些不属于常规文件系统的特殊文件。 查找ping命令的二进制文件&#xff0c;你可以使用如下命令&#xff1a; whereis -b ping查看命令的帮助文件&#xff0c;可以添…...

牛客网SQL进阶128:未完成试卷数大于1的有效用户

官网链接&#xff1a; 未完成试卷数大于1的有效用户_牛客题霸_牛客网现有试卷作答记录表exam_record&#xff08;uid用户ID, exam_id试卷ID, st。题目来自【牛客题霸】https://www.nowcoder.com/practice/46cb7a33f7204f3ba7f6536d2fc04286?tpId240&tqId2183007&ru%2…...

GitHub的使用操作

记得看目录哦&#xff01; 1. 创建仓库2. 下载desktop3. 把创建的库克隆到本地4. 文件拷贝到本地仓库![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/7171ac6c4ca14e3b8d22717121f79c9e.png)5. 在网址后面加/compare进行比较6. 给系统添加功能 1. 创建仓库 2. 下载…...

智慧公厕管理软件

随着城市化的不断推进&#xff0c;城市公共设施逐渐完善&#xff0c;其中智慧公厕的建设也在不断提速。智慧公厕作为城市基础设施的重要组成部分&#xff0c;对城市卫生水平提升有着不可忽视的作用。而智慧公厕管理软件更是智慧公厕管理的基础&#xff0c;是公共厕所智慧化管理…...

【30秒看懂大数据】数据中台

知幽科技是一家专注企业数字/智化&#xff0c;围绕数据价值应用的一站式数智化解决方案的咨询公司&#xff0c;也包括了为企业提供定制化数据培训&#xff0c;力求做企业最好的数智化决策伙伴。 点击上方「蓝字」关注我们 30秒看懂大数据专栏 让您在有限的碎片化时间&#xf…...

【UI自动化测试技术】自动化测试研究:Python+Selenium+Pytest+Allure,详解UI自动化测试,了解元素交互的常用方法(精)(三)

导言 在之前的文章里&#xff0c;我们一起学习了定位方式、等待机制等内容。相信通过之前的学习&#xff0c;你已经掌握了WEB自动化的一些入门知识&#xff0c;具备了编写代码的一些基础知识和能力。这篇文章&#xff0c;让我们一起学习一下模拟键盘事件。 在实际的项目当中&a…...

GPT-4带来的思想火花

GPT-4能够以其强大的生成能力和广泛的知识储备激发出众多思想火花。它能够在不同的情境下生成新颖的观点、独特的见解和富有创意的解决方案&#xff0c;这不仅有助于用户突破思维定势&#xff0c;还能促进知识与信息在不同领域的交叉融合。 1.GPT-4出色的创新思考和知识整合能…...

使用倒模耳机壳UV村脂胶液制作舞台监听耳返入耳式耳机壳有哪些优点?

使用倒模耳机壳UV树脂胶液制作舞台监听耳返入耳式耳机壳有很多优点&#xff0c;具体如下&#xff1a; 高音质表现&#xff1a;通过倒模工艺制作的耳机壳能够更好地贴合耳朵&#xff0c;减少声音散射和反射&#xff0c;提高声音的清晰度和质感。这对于舞台监听来说非常重要&…...

html从零开始8:css3新特性、动画、媒体查询、雪碧图、字体图标【搬代码】

css3新特性 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta http-equiv"X-UA-Compatible" content"IEedge"><meta name"viewport" content"widthdevice-width, …...

HAL库 STM32驱动W25QXX驱动例程

HAL库 STM32驱动W25QXX驱动例程 &#x1f4cd;驱动程序参考&#xff1a;《STM32CubeMX | 基于STM32使用HAL库W25Q128驱动程序》&#x1f511; 驱动方式&#xff1a;硬件SPI方式和SPI DMA方式。&#x1f516;适用于&#xff1a;W25X系列/Q系列芯片:W25Q80、W25Q16、W25Q32、 W25…...

C#入门及进阶|数组和集合(九):Stack类

在C#中&#xff0c;通过类Stack来封装对栈的操作&#xff0c;使得对栈的操作变得非常简单和容易理解。 栈是按照“后进先出”的原则来操作元素。 栈集合常用的属性和方法: 属性说明Count获取 Stack 中包含的元素数。方法说明Peek返回位于栈顶部的对象但不将其移除。Po…...

算法训练day31贪心算法理论基础Leetcode455分发饼干376摆动序列53最大子序和

贪心算法理论基础 文章链接 代码随想录 (programmercarl.com) 说实话贪心算法并没有固定的套路。最好用的策略就是举反例&#xff0c;如果想不到反例&#xff0c;那么就试一试贪心吧。 面试中基本不会让面试者现场证明贪心的合理性&#xff0c;代码写出来跑过测试用例即可&…...

Java与JavaScript同源不同性

Java是目前编程领域使用非常广泛的编程语言&#xff0c;相较于JavaScript&#xff0c;Java更被人们熟知。很多Java程序员想学门脚本语言&#xff0c;一看JavaScript和Java这么像&#xff0c;很有亲切感&#xff0c;那干脆就学它了&#xff0c;这也间接的帮助了JavaScript的发展…...

【JavaEE】spring boot快速上手

SpringBoot快速上手 文章目录 SpringBoot快速上手Maven会出现的一个官方bug创建完项目之后常用的的三个功能依赖管理Maven仓库中央仓库本地仓库国内源配置私服 springboot项目创建什么是springspring boot项目的创建Hello Worldweb服务器 SpringMVC什么是SpringWebMVC什么是MVC…...

【数据结构】16 二叉树的定义,性质,存储结构(以及先序、后序、中序遍历)

二叉树 一个二叉树是一个有穷的结点集合。 它是由根节点和称为其左子树和右子树的两个不相交的二叉树组成的。 二叉树可具有以下5种形态。 性质 一个二叉树第i层的最大结点数为 2 i − 1 2^{i-1} 2i−1, i ≥ 1 i \geq 1 i≥1 每层最大结点可以对应完美二叉树&#xff08;…...

GPT SOVITS项目 一分钟克隆 (文字输出)

步骤流程&#xff1a;&#xff08;首先使用UVR 提取人声文件&#xff0c;然后按下面步骤进行&#xff09; 注意这里提交的音频是参考的音频...

python34-Python列表和元组之加法

列表和元组支持加法运算&#xff0c;加法的和就是两个列表或元组所包含的元素的总和。 需要指出的是&#xff0c;列表只能和列表相加;元组只能和元组相加;元组不能直接和列表相加。 如下代码示范了元组和列表的加法运算。 # !/usr/bin/env python# -*- coding: utf-8 -*-# T…...

不做程序员了(转岗半年后对程序员岗位的思考)

不做程序员了&#xff08;转岗半年后对程序员岗位的思考&#xff09; 前言 好久没有更新了&#xff0c;已经久到CSDN的小编来问我为什么不更了。原因是我半年前转岗了&#xff0c;不再做程序员了&#xff0c;由程序员变为了产品经理。废话不多说&#xff0c;换个视角来给大家…...

DS:八大排序之直接插入排序、希尔排序和选择排序

创作不易&#xff0c;感谢三连支持&#xff01;&#xff01; 一、排序的概念及运用 1.1 排序的概念 排序&#xff1a;所谓排序&#xff0c;就是使一串记录&#xff0c;按照其中的某个或某些关键字的大小&#xff0c;递增或递减的排列起 来的操作。稳定性&…...

【MySQL】-21 MySQL综合-8(MySQL默认值+MySQL非空约束+MySQL查看表中的约束)

MySQL默认值MySQL非空约束MySQL查看表中的约束 MySQL默认值在创建表时设置默认值约束在修改表MySQL默认值在创建表时设置默认值约束在修改表时添加默认值约束删除默认值约束删除默认值约束 MySQL非空约束在创建表时设置非空约束在修改表时添加非空约束删除非空约束 MySQL查看表…...

力扣hot3--并查集+哈希

第一想法是排个序然后遍历一遍&#xff0c;but时间复杂度就超啦 并查集居然与哈希结合了&#xff08;&#xff09; 已经好久没用过并查集了&#xff0c;&#xff0c;&#xff0c;我们用哈希表f_node中来记录原结点的父节点&#xff0c;其中key是原结点&#xff0c;value是父节点…...

微信网页版能够使用(会顶掉微信app的登陆)

一、文件结构 新建目录chrome新建icons&#xff0c;其中图片你自己找吧新建文件manifest.json新建文件wx-rules.json 二、文件内容 对应的png你们自己改下 1、manifest.json {"manifest_version": 3,"name": "wechat-need-web","author…...

word软件中硬件图像加速有什么用处?禁用硬件图形加速(G)会影响word文档中插入图片的分辨率吗?

问题描述&#xff1a;word软件中硬件图像加速有什么用处&#xff1f;禁用硬件图形加速(G)会影响word文档中插入图片的分辨率吗&#xff1f; 问题解答&#xff1a; 在 Microsoft Word 中&#xff0c;硬件图形加速主要用于提高图形元素的渲染速度和性能&#xff0c;特别是处理大…...

.NET Core MongoDB数据仓储和工作单元模式封装

前言 上一章我们把系统所需要的MongoDB集合设计好了&#xff0c;这一章我们的主要任务是使用.NET Core应用程序连接MongoDB并且封装MongoDB数据仓储和工作单元模式&#xff0c;因为本章内容涵盖的有点多关于仓储和工作单元的使用就放到下一章节中讲解了。仓储模式&#xff08;R…...

lua:有关表访问的metamethod

针对在两种正常状态&#xff1a;表的不存在的域的查询和修改&#xff0c;Lua也提供了改变 tables的行为的方法。 index metamethod 我们可以通过index元方法来实现访问table内部不存在的域时人为操控返回数据。 比如以下测试代码&#xff1a; local set {1,2,3} setmetata…...

【MySQL】索引事务

MySQL索引事务 1. 索引1.1 概念1.2 作用1.3 使用场景1.4 使用1.5 案例 2. 事务2.2 事物的概念2.3 使用 3. 内容重点总结 1. 索引 1.1 概念 索引是一种特殊的文件&#xff0c;包含着对数据表里所有记录的引用指针。可以对表中的一列或多列创建索引&#xff0c; 并指定索引的类…...

ChatGPT重大升级:能自动记住用户的习惯和喜好,用户有权决定是否共享数据给OpenAI

OpenAI刚刚宣布了ChatGPT的一项激动人心的更新&#xff01; OpenAI在ChatGPT中新加了记忆功能和用户控制选项&#xff0c;这意味着GPT能够在与用户的互动中记住之前的对话内容&#xff0c;并利用这些信息在后续的交谈中提供更加相关和定制化的回答。 这一功能目前正处于测试阶…...

CSS设置盒子阴影

语法 box-shadow: *h-shadow v-shadow blur spread color* inset; 注释: box-shadow向框添加一个或多个阴影. 该属性是由逗号分隔的阴影列表,每个阴影由2-4个长度值、可选的颜色值及可选的inset关键词来规定。省略长度的值是0。 外阴影 a、给元素右边框和下边框加外阴影——把…...

文件夹删不掉,显示在另一个文件中打开怎么办

问题&#xff1a; 一、想要删掉这个文件夹&#xff0c;却因为文件夹中的文件打开了删不掉&#xff0c;这里我因为做的测试&#xff0c;所以是知道打开了什么 二、一般情况下文件比较多时&#xff0c;是不知道打开了什么的&#xff0c;长这个样子 解决&#xff1a; 一、打开任…...

阿里云香港云服务器租用_BGP多线网络_CN2高速线路测试

阿里云香港服务器中国香港数据中心网络线路类型BGP多线精品&#xff0c;中国电信CN2高速网络高质量、大规格BGP带宽&#xff0c;运营商精品公网直连中国内地&#xff0c;时延更低&#xff0c;优化海外回中国内地流量的公网线路&#xff0c;可以提高国际业务访问质量。阿里云服务…...

C# 异步方法的使用场景

我一直认为C#的异步方法只是一堆华而不实的东西&#xff0c;坑特别多&#xff0c;比起直接自建线程也没有任何优势。 直到有一天&#xff0c;一个需求场景&#xff0c;让我再次想到了C#的异步方法。 需求场景如下&#xff1a;需要写一个程序控制机械臂完成各种动作。每个动作要…...

Lua 教程

Lua 教程 (今天又又又开新坑啦) Lua 教程 手册简介 Lua 是一种轻量小巧的脚本语言&#xff0c;用标准C语言编写并以源代码形式开放。 手册说明 Lua是什么? Lua 是一个小巧的脚本语言。是巴西里约热内卢天主教大学&#xff08;Pontifical Catholic University of Rio de …...

CleanMyMac X2024版本有哪些常见的使用场景?

CleanMyMac X作为一款Mac电脑清理和优化工具&#xff0c;具有多种使用场景。以下是一些常见的使用场景&#xff1a; 清理系统垃圾文件&#xff1a;CleanMyMac X可以智能扫描Mac磁盘空间&#xff0c;清理系统冗余文件和各种软件应用产生的垃圾文件&#xff0c;如缓存、日志文件…...

《Docker快速入门:从0到1构建你的第一个容器!》

《Docker快速入门&#xff1a;从0到1构建你的第一个容器&#xff01;》 前言 欢迎来到Docker的世界&#xff0c;一个让应用程序打包、部署和运行更加容易的神奇平台。Docker改变了我们对于应用开发和分发的看法&#xff0c;它通过容器技术让软件的携带和运行变得前所未有的轻…...

NLP_Transformer架构

文章目录 Transformer架构剖析编码器-解码器架构各种注意力的应用Transformer中的自注意力Transformer中的多头自注意力Transformer中的编码器-解码器注意力Transformer中的注意力掩码和因果注意力 编码器的输入和位置编码编码器的内部结构编码器的输出和编码器-解码器的连接解…...

CVE-2012-2311 漏洞复现

CVE-2012-2311 这个漏洞被爆出来以后&#xff0c;PHP官方对其进行了修补&#xff0c;发布了新版本5.4.2及5.3.12&#xff0c;但这个修复是不完全的&#xff0c;可以被绕过&#xff0c;进而衍生出CVE-2012-2311漏洞。 PHP的修复方法是对-进行了检查&#xff1a; if(query_str…...

多线程面试题汇总

多线程面试题汇总 一、多线程1、线程的生命周期2、线程的创建&#xff08;函数创建&#xff09;3、线程的创建&#xff08;使用类&#xff09;4、守护线程 二、全局解释器锁1、使用单线程实现累加到5000000002、使用多线程实现累加到5000000003、总结 三、线程安全1、多线程之数…...

CentOS7.9+Kubernetes1.29.2+Docker25.0.3高可用集群二进制部署

CentOS7.9Kubernetes1.29.2Docker25.0.3高可用集群二进制部署 Kubernetes高可用集群&#xff08;Kubernetes1.29.2Docker25.0.3&#xff09;二进制部署二进制软件部署flannel v0.22.3网络&#xff0c;使用的etcd是版本3&#xff0c;与之前使用版本2不同。查看官方文档进行了解…...

STM32——OLED菜单(二级菜单)

文章目录 一.补充二. 二级菜单代码 简介&#xff1a;首先在我的51 I2C里面有OLED详细讲解&#xff0c;本期代码从51OLED基础上移植过来的&#xff0c;可以先看完那篇文章&#xff0c;在看这个&#xff0c;然后按键我是用的定时器扫描不会堵塞程序,可以翻开我的文章有单独的定时…...

配置Vite+React+TS项目

初始化 执行npm create vite并填写项目名、用那个框架。。 配置 路径别名 在vite.config.ts里面配置&#xff1a; import { defineConfig } from vite import react from vitejs/plugin-react import path from pathexport default defineConfig({plugins: [react()],reso…...