AWX部署

news/2024/9/24 18:06:41

目录
  • awx
    • 1. 部署awx
      • 1.1 克隆仓库
      • 1.2 生成yaml
      • 1.3 部署operator
      • 1.4 查看pod
      • 1.5 修改镜像地址
    • 2. 登录awx
      • 2.1 查看端口
      • 2.2 查看默认密码

awx

awx是红帽Ansible Tower的开源版本,他的功能是可以使用web界面来操作ansible

操作系统使用openEuler 22.03

这里是在k8s上部署的,需要使用动态制备pvc,因为他有一个数据库需要使用存储

1. 部署awx

1.1 克隆仓库

[root@master ~]# git clone https://gitee.com/yftyxa/awx-operator.git
[root@master ~]# cd awx-operator/config/default/
[root@master default]# ls
awx-demo.yaml  kustomization.yaml  manager_auth_proxy_patch.yaml  manager_config_patch.yaml

在这里会有4个yaml文件,但是你如果打开看的话,是跟我们日常编写的yaml格式是不一样的,我们现在需要通过这些文件来生成原始的yaml

1.2 生成yaml

我们可以使用kubectl kustomize这个命令来生成yaml

但是有一点需要注意,这里需要指定的是一个目录,而不是一个文件

# 我们可以创建一个目录来存放生成过后的yaml,别都放在这搞混了
[root@master default]# mkdir deploy
[root@master default]# cd deploy/
[root@master default]# kubectl kustomize ../
[root@master deploy]# kubectl kustomize ../ > awx-operator.yaml

1.3 部署operator

[root@master deploy]# kubectl apply -f awx-operator.yaml 
namespace/awx created
customresourcedefinition.apiextensions.k8s.io/awxbackups.awx.ansible.com created
customresourcedefinition.apiextensions.k8s.io/awxrestores.awx.ansible.com created
customresourcedefinition.apiextensions.k8s.io/awxs.awx.ansible.com created
serviceaccount/awx-operator-controller-manager created
role.rbac.authorization.k8s.io/awx-operator-awx-manager-role created
role.rbac.authorization.k8s.io/awx-operator-leader-election-role created
clusterrole.rbac.authorization.k8s.io/awx-operator-metrics-reader created
clusterrole.rbac.authorization.k8s.io/awx-operator-proxy-role created
rolebinding.rbac.authorization.k8s.io/awx-operator-awx-manager-rolebinding created
rolebinding.rbac.authorization.k8s.io/awx-operator-leader-election-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/awx-operator-proxy-rolebinding created
configmap/awx-operator-awx-manager-config created
service/awx-operator-controller-manager-metrics-service created
deployment.apps/awx-operator-controller-manager created
error: unable to recognize "awx-operator.yaml": no matches for kind "AWX" in version "awx.ansible.com/v1beta1"

这里会有一个报错,如果你也遇到了不用管他,再执行一遍这个文件

[root@master deploy]# kubectl apply -f awx-operator.yaml 
namespace/awx created
customresourcedefinition.apiextensions.k8s.io/awxbackups.awx.ansible.com created
customresourcedefinition.apiextensions.k8s.io/awxrestores.awx.ansible.com created
customresourcedefinition.apiextensions.k8s.io/awxs.awx.ansible.com created
serviceaccount/awx-operator-controller-manager created
role.rbac.authorization.k8s.io/awx-operator-awx-manager-role created
role.rbac.authorization.k8s.io/awx-operator-leader-election-role created
clusterrole.rbac.authorization.k8s.io/awx-operator-metrics-reader created
clusterrole.rbac.authorization.k8s.io/awx-operator-proxy-role created
rolebinding.rbac.authorization.k8s.io/awx-operator-awx-manager-rolebinding created
rolebinding.rbac.authorization.k8s.io/awx-operator-leader-election-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/awx-operator-proxy-rolebinding created
configmap/awx-operator-awx-manager-config created
service/awx-operator-controller-manager-metrics-service created
deployment.apps/awx-operator-controller-manager created
awx.awx.ansible.com/awx-operator-awx-demo created

再执行一遍就没有报错了

1.4 查看pod

[root@master deploy]# kubectl get pods -n awx
NAME                                               READY   STATUS    RESTARTS   AGE
awx-operator-awx-demo-postgres-13-0                1/1     Running   0          6m11s
awx-operator-awx-demo-task-6d4ff878ff-txb78        4/4     Running   0          5m21s
awx-operator-awx-demo-web-cb9cc8f9c-lkphd          3/3     Running   0          3m30s
awx-operator-controller-manager-85d95854c9-vqf4s   2/2     Running   0          6m27s

如果你在这个过程中出现了pending,一下pending的原因,很大可能是因为pvc的缘故

1.5 修改镜像地址

注意!!!

回到上一级目录,也就是default目录,这里面如果存在awx-demo.yaml这个文件的话就直接修改,不存在的话就创建

因为dockerhub现在国内访问不了,所以他的数据库镜像包括redis的镜像都是拉不到的,我们需要对镜像进行修改

[root@master deploy]# vim awx-demo.yaml
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:name: awx-demonamespace: awx
spec:service_type: nodeportpostgres_image: swr.cn-east-3.myhuaweicloud.com/hcie_openeuler/postgrespostgres_version: "13"redis_image: swr.cn-east-3.myhuaweicloud.com/hcie_openeuler/redisredis_version: "7"

然后apply这个文件

[root@master deploy]# kubectl apply -f awx-demo.yaml 

执行这个文件之后,等待一会然后去查看pod

[root@master deploy]# kubectl get pods -n awx
NAME                                               READY   STATUS    RESTARTS   AGE
awx-demo-postgres-13-0                             1/1     Running   0          7m28s
awx-demo-task-6fc456bbbd-9jcv9                     4/4     Running   0          7m2s
awx-demo-web-7f78447cd-74hkw                       3/3     Running   0          6m55s
awx-operator-awx-demo-postgres-13-0                1/1     Running   0          17m
awx-operator-awx-demo-task-6d4ff878ff-txb78        4/4     Running   0          16m
awx-operator-awx-demo-web-cb9cc8f9c-lkphd          3/3     Running   0          14m
awx-operator-controller-manager-85d95854c9-vqf4s   2/2     Running   0          17m

这里就会有这么多的pod全都是running了,那么部署就完成了

2. 登录awx

2.1 查看端口

[root@master default]# kubectl get svc -n awx
NAME                                              TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
awx-operator-awx-demo-postgres-13                 ClusterIP   None             <none>        5432/TCP       34m
awx-operator-awx-demo-service                     NodePort    10.109.223.144   <none>        80:30080/TCP   34m
awx-operator-controller-manager-metrics-service   ClusterIP   10.108.166.93    <none>        8443/TCP       35m

  • 默认账号是admin

2.2 查看默认密码

默认密码是在awx命名空间下有一个secret

[root@master deploy]# kubectl get secrets -n awx |grep admin
awx-operator-awx-demo-admin-password           Opaque                 

会有一个这个secret,我们将数据拿出来就好了

[root@master deploy]# kubectl get secrets -n awx awx-operator-awx-demo-admin-password -o yaml |head -5
apiVersion: v1
data:password: YlhMR3VtSkxHYkN6d1ZiUHhVZkVpVEp1TmJaa2N6OHc=
kind: Secret
metadata:

这里有一个password,注意这个password是base64加密过后的,我们还需要解密

[root@master deploy]# echo YlhMR3VtSkxHYkN6d1ZiUHhVZkVpVEp1TmJaa2N6OHc= |base64 -d
bXLGumJLGbCzwVbPxUfEiTJuNbZkcz8w

他输出的这一段就是密码了

登录进来之后就是这样的了

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.ryyt.cn/news/46204.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈,一经查实,立即删除!

相关文章

开源表单设计器好不好用?优点怎么样?

开源表单设计器的优势表现在哪?一起来看看。要想实现提质增效,让数据资源更好地利用起来,助力企业增产创收,那就需要采用更理想的办公利器。低代码技术平台是近些年流行于各职场办公中的重要软件平台,更灵活、性能更高、更靠谱、优势特点也非常多,在推动企业实现数字化转…

condition expression returns non-Boolean

报错这个其实代表你的表达式写错了,正确的是 这里我使用的是单一网关参数可以在发起或者完成的时候,设置 "variable":{"a":200 } 这样发起流程后,会根据条件走向符合的节点

实验7_文件应用编程

#include <stdio.h> #include <string.h> #include <stdlib.h> int main() {int cnt=0;char c;FILE *fp;fp=fopen("data4.txt","r");while(!feof(fp)){c=fgetc(fp);if(c==\n||c== ||c==\t)continue;cnt++;}printf("文件中所含字符数…

java面向对象三大特征

免责声明:java基础资料均来自于韩顺平老师的《循序渐进学Java零基础》教案,具体视频内容可以去B站观看,这些资料仅用于学习交流,不得转载用于商业活动 1.Java面向对象三大特征 Java面向对象编程有三大特征:封装、继承、多态 1.1 封装 封装(encapsulation)就是把抽象出的数…

米尔全志T527系列加推工控板和工控机,更多工业场景DEMO

自米尔首发基于全志T527系列核心板以来,这款基于八核CPU的高性能国产核心板得到广大客户的好评。这款产品支持Android13、Linux5.15操作系统,还将适配Ubuntu系统,满足开发者们更灵活地开发各种创新应用。 米尔为满足不同的客户需求,推出基于全志T527的全系列的产品:米粉派…

manim边学边做--BulletedList

BulletedList是Mobjects分类中用来显示列表的class。使用BulletedList可以帮助我们快速生成一个对齐的列表结构。BulletedList在manim各个模块中的位置如上图中所示。 1. 主要参数 BulletedList的主要参数有:参数名称 类型 说明items list 列表的内容buff float 列表内容之间的…

vue-devtools (firefox浏览器,火狐浏览器) Vue调试

vue-devtools (firefox浏览器,火狐浏览器) vuedevtoolsvue-devtools (firefox浏览器)打开firefox浏览器,使用快捷键【Ctrl+Shift+A】打开组件管理列表,并搜索vue安装重启Firefox访问一个Vue应用,打开 开发者工具