@@ -53,4 +53,71 @@ plugin and the other is the `cluster type` plugin.
5353
5454## How to use
5555
56- see more details see [ example here] ( plugins/example/readme.md )
56+ ### use plugin though Kubefile
57+
58+ Define the default plugin in Kubefile to build the image and run it.
59+
60+ In many cases it is possible to use plugins without using Clusterfile, essentially sealer stores the Clusterfile plugin
61+ configuration in the Rootfs/Plugins directory before using it, so we can define the default plugin when we build the
62+ image.
63+
64+ For example, build a new sealer image with plugins/example/example.yaml, only need to do is coping your plugin file
65+ to ` plugins/ ` directory.
66+
67+ Kubefile:
68+
69+ ``` shell script
70+ FROM docker.io/sealerio/kubernetes:v1-22-15-sealerio-2
71+ COPY example.yaml plugins/
72+ ```
73+
74+ Build a Sealer Image that contains a plugin (or more plugins):
75+
76+ ``` shell script
77+ sealer build -t kubernetes-with-plugin:v1 .
78+ ```
79+
80+ Run the image and the plugin will also be executed without having to define the plugin in the Clusterfile:
81+ ` sealer run kubernetes-with-plugin:v1 -m x.x.x.x -p xxx `
82+
83+ ### use plugin though Clusterfile
84+
85+ For example, set plugins/example/example.yaml content at clusterfile:
86+
87+ ``` yaml
88+ apiVersion : sealer.io/v2
89+ kind : Cluster
90+ metadata :
91+ name : default-kubernetes-cluster
92+ spec :
93+ image : docker.io/sealerio/kubernetes:v1.22.15
94+ ssh :
95+ passwd : xxx
96+ hosts :
97+ - ips : [ 192.168.0.2,192.168.0.3,192.168.0.4 ]
98+ roles : [ master ]
99+ - ips : [ 192.168.0.5 ]
100+ roles : [ node ]
101+ ---
102+ apiVersion : sealer.io/v2
103+ kind : Plugin
104+ metadata :
105+ name : pre_init_host
106+ spec :
107+ type : SHELL
108+ action : pre-init-host
109+ scope : master
110+ data : |
111+ set -e;set -x
112+ echo "i am pre init host plugin"
113+ ` ` `
114+
115+ ` ` ` shell script
116+ sealer apply -f Clusterfile
117+ ```
118+
119+ ## Available plugin list
120+
121+ | name | owner | category| link | description |
122+ | :-----| ----: | ----: | ----: | ----: |
123+ | example | sealer community | host type | plugins/example/example.yaml| just a little plugin example for user to quickly experience |
0 commit comments