跳至内容

为测试创建 minikube 集群

如果您没有现有的集群,则可以将 awx-operator 部署到 Minikube 集群以进行测试。由于不同的操作系统和硬件环境,请参阅 Minikube 官方文档以获取更多信息。

$ minikube start --cpus=4 --memory=6g --addons=ingress
😄  minikube v1.23.2 on Fedora 34
  Using the docker driver based on existing profile
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
🏃  Updating the running docker "minikube" container ...
🐳  Preparing Kubernetes v1.22.2 on Docker 20.10.8 ...
🔎  Verifying Kubernetes components...
     Using image gcr.io/k8s-minikube/storage-provisioner:v5
     Using image k8s.gcr.io/ingress-nginx/controller:v1.0.0-beta.3
     Using image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0
     Using image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0
🔎  Verifying ingress addon...
🌟  Enabled addons: storage-provisioner, default-storageclass, ingress
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

部署 Minikube 后,请检查节点和 kube-apiserver 通信是否按预期工作。

$ minikube kubectl -- get nodes
NAME       STATUS   ROLES                  AGE    VERSION
minikube   Ready    control-plane,master   113s   v1.22.2

$ minikube kubectl -- get pods -A
NAMESPACE       NAME                                        READY   STATUS      RESTARTS   AGE
ingress-nginx   ingress-nginx-admission-create--1-kk67h     0/1     Completed   0          2m1s
ingress-nginx   ingress-nginx-admission-patch--1-7mp2r      0/1     Completed   1          2m1s
ingress-nginx   ingress-nginx-controller-69bdbc4d57-bmwg8   1/1     Running     0          2m
kube-system     coredns-78fcd69978-q7nmx                    1/1     Running     0          2m
kube-system     etcd-minikube                               1/1     Running     0          2m12s
kube-system     kube-apiserver-minikube                     1/1     Running     0          2m16s
kube-system     kube-controller-manager-minikube            1/1     Running     0          2m12s
kube-system     kube-proxy-5mmnw                            1/1     Running     0          2m1s
kube-system     kube-scheduler-minikube                     1/1     Running     0          2m15s
kube-system     storage-provisioner                         1/1     Running     0          2m11s

不需要单独安装 kubectl,因为它已包含在 minikube 中。如上所示,只需在 kubectl 命令前添加前缀 minikube kubectl --,例如 kubectl get nodes 将变为 minikube kubectl -- get nodes

让我们创建一个别名以方便使用

alias kubectl="minikube kubectl --"

现在,您可以继续安装 AWX Operator 和 AWX。有关更多说明,请参阅 基本安装

提示

部署 AWX 后,可以通过运行以下命令访问 AWX 实例

minikube service -n awx awx-demo-service --url

对于在 Minikube 中使用 Nginx Ingress Controller 的示例,请不要错过我们的 演示视频