djzager.hello_world_k8s

Ansible角色:Hello World Kubernetes

构建状态

管理Kubernetes | OpenShift中的Hello World应用程序。此项目还包含在Kubernetes | OpenShift集群中使用Ansible Operator部署该角色所需的必要组件。

要求

角色变量

请参阅 defaults/main.yml

依赖

示例剧本

注意 以下示例假设您有一个正在运行的Kubernetes | OpenShift集群,并且您在 my-hello-world-namespace 命名空间中拥有足够的权限。

- hosts: localhost
  vars:
    name: my-hello-world
    namespace: my-hello-world-namespace
    size: 3
  roles:
    - djzager.hello_world_k8s

示例操作器

注意 以下示例假设您实际上是Kubernetes | OpenShift集群的集群管理员。这是因为您将创建一个角色、服务帐户角色绑定和自定义资源定义。

首先,我们使用 operator-sdk 构建我们的操作器,链接 这里

$ operator-sdk build hello-world-operator

然后,我们创建操作器运行所需的重要对象:

$ kubectl create -f deploy/service_account.yaml \
                 -f deploy/role.yaml \
                 -f deploy/role_binding.yaml \
                 -f deploy/crds/examples_v1alpha1_helloworld_crd.yaml \

接下来,我们启动操作器:

# 使用上面operator-sdk构建步骤中的镜像名称
# 并将imagePullPolicy设置为Never
$ sed 's|REPLACE_IMAGE|hello-world-operator|g; s|Always|Never|' deploy/operator.yaml | kubectl create -f -

最后,创建一个HelloWorld资源:

$ kubectl create -f deploy/crds/examples_v1alpha1_helloworld_cr.yaml
关于项目

Manage hello-world application in Kubernetes|OpenShift

安装
ansible-galaxy install djzager.hello_world_k8s
许可证
Unknown
下载
116
拥有者