New to Kubepack? Please start here.
Using Kubepack as an App User
How To Use
If you want to use others application with pack, then follow below instruction:
- Create a git repository.
- Create dependency-list.yaml file in the repository. See dependency-list.yaml doc.
- Add all the dependencies under
dependenciesin dependency-list.yaml file. - Run
pack dep -f . -v 10to get all the dependencies inmanifests/vendorfolder. - Run
pack edit -f . -p <filepath>, if you want to change some file frommanifests/vendorfolder. This command will generate a patch undermanifests/patchfolder.manifests/vendorwill be unchanged. - Run
pack up -f .to combinemanifests/patchandmanifests/vendorfolder files. And final combination will be undermanifests/outputfolder. - Now, all is need to do
kubectl apply -R -f manifests/output/. Then, your desired application will be deployed in kubernetes cluster.
Example
In this example, you’ll see how to deploy AppsCode kubed
in minikube using Pack.
In this example, we’re using this test-case.
Below command show the dependency-list.yaml file.
$ cat dependency-list.yaml
items:
- package: github.com/kubepack/test-kubed
branch: master
dependency-list.yaml file contain test-kubed as dependencies. test-kubed contains
all the necessary yaml file needs to deploy kubed in minikube cluster.
Now, pack dep -f . command will pull all the dependencies and place it in manifests/vendor folder.
If test-kubed repository also depend on some other repository then pack will get that too.
$ pack dep -f .
$ tree manifests/vendor/
manifests/vendor/
└── github.com
└── kubepack
└── test-kubed
├── manifests
│ └── app
│ ├── deployment.yaml
│ ├── kubed-config.yaml
│ └── service.yaml
└── dependency-list.yaml
5 directories, 4 files
Now, all the dependencies in place. Now, we can edit manifests/vendor and this will generate patch.
We’re want to change kubed-config.yaml file, which is a secret yaml file.
$ cat manifests/vendor/github.com/kubepack/test-kubed/manifests/app/kubed-config.yaml
apiVersion: v1
data:
config.yaml: YXBpU2VydmVyOgogIGFkZHJlc3M6IDo4MDgwCiAgZW5hYmxlUmV2ZXJzZUluZGV4OiB0cnVlCiAgZW5hYmxlU2VhcmNoSW5kZXg6IHRydWUKY2x1c3Rlck5hbWU6IHVuaWNvcm4KZW5hYmxlQ29uZmlnU3luY2VyOiB0cnVlCmV2ZW50Rm9yd2FyZGVyOgogIGNzckV2ZW50czoKICAgIGhhbmRsZTogZm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Z2VTZWNyZXROYW1lOiBzbmFwLXNlY3JldAo=
kind: Secret
metadata:
creationTimestamp: null
labels:
app: kubed
name: kubed-config
namespace: kube-system
We’ll change config.yaml under data field. config.yaml value will be YXBpU2VydmVyOgogIGFkZHJlc3M6IDo4MDgwCiAgZW5hYmxlUmV2ZXJzZUluZGV4OiB0cnVlCiAgZW5hYmxlU2VhcmNoSW5kZXg6IHRydWUKY2x1c3Rlck5hbWU6IHVuaWNvcm4KZW5hYmxlQ29uZmlnU3luY2VyOiB0cnVlCg==
$ pack edit -s manifests/vendor/github.com/kubepack/test-kubed/manifests/app/kubed-config.yaml
Above command will open file in editor.
Then, change config.yaml to above value. This will generate a patch in manifests/patch folder.
Below $ pack up -f . command will combine manifests/patch and manifests/vendor folder files and dump in manifests/output folder.
$ pack up -f .
$ kubectl apply -R -f manifests/output/
$ kubectl apply -R -f manifests/output/ command will deploy kubed in minikube cluster.