前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CoreOS 配置工具 Ignition 官方示例

CoreOS 配置工具 Ignition 官方示例

作者头像
康怀帅
发布2018-02-28 15:08:30
2.8K0
发布2018-02-28 15:08:30
举报
文章被收录于专栏:康怀帅的专栏

CoreOS 配置工具已由 Ignition 代替 cloud-config

GitHub:https://github.com/coreos/ignition

使用 Ignition 需要两步:

  • 第一步编写 Container Linux Config ( yaml 格式 )
  • 第二步使用 container-linux-config-transpilerContainer Linux Config 转化为 Ignition Config (json 格式)
代码语言:javascript
复制
$ ct-v0.5.0-x86_64-apple-darwin -in-file ignition.yaml  > ignition.json

container-linux-config-transpiler 安装方法:

https://github.com/coreos/container-linux-config-transpiler/releases 下载二进制文件移入 PATH,并赋予可执行权限之后即可使用。

官方文档:https://coreos.com/os/docs/latest/overview-of-ct.html

常用配置举例

etcd

代码语言:javascript
复制
etcd:
  name:                        coreos3
  discovery: https://discovery.etcd.io/249ea9815631abc753fe4a4743f147d2
  advertise_client_urls:       http://192.168.57.102:2379
  initial_advertise_peer_urls: http://192.168.57.102:2380
  listen_client_urls:          http://192.168.57.102:2379,http://0.0.0.0:4001
  listen_peer_urls:            http://0.0.0.0:2380

网络配置

通过与网络接口名称( enp0s3 等)匹配来设置静态或动态 IP 地址

代码语言:javascript
复制
networkd:
   units:
     - name: 10-static.network
       contents: |
         [Match]
         Name=enp0s3

         [Network]
         Address=192.168.57.102/24
     - name: 20-dhcp.network
       contents: |
         [Match]
         Name=enp0s8

         [Network]
         DHCP=yes

用户

代码语言:javascript
复制
passwd:
  users:
    - name: core
      ssh_authorized_keys:
        - ssh-rsa SSH_PUB
      groups:
        - wheel
        - sudo
        - docker

systemd unit

代码语言:javascript
复制
systemd:
  units:
    - name: settimezone.service
      enable: true
      contents: |
        [Unit]
        Description=Set the time zone

        [Service]
        ExecStart=/usr/bin/timedatectl set-timezone  PRC
        RemainAfterExit=yes
        Type=oneshot

文件

代码语言:javascript
复制
storage:
  files:
    - filesystem: "root"
      path:       "/etc/hostname"
      mode:       0644
      contents:
        inline: coreos3
    - filesystem: "root"
      path:       "/etc/resolv.conf"
      mode:       0644
      contents:
        inline: |
          nameserver 114.114.114.114

示例文件

https://github.com/khs1994-docker/coreos/blob/master/disk/ignition-1.example.yaml

相关链接

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2016-09-02,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 常用配置举例
    • etcd
      • 网络配置
        • 用户
          • systemd unit
            • 文件
            • 示例文件
            • 相关链接
            相关产品与服务
            容器服务
            腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
            领券
            问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档