LoginSignup
0
0

More than 3 years have passed since last update.

pulumi v1.5.2 getting started (kubernetes/minikube)

Posted at

Pulumi がどんなものかを確認するために getting started を minikube で行う。成果物はこれ

Getting Started

aws cdk の比較として pulumi の名前があったので試してみた。一人で試すぐらいなら Github で連携すると、 terraform の backend が pulumi で managed されているような感じで簡単に無料で導入できる。

基本的に手順に従っていれば getting started は進められた。

Modify the Program の部分で minikube で行う場合は、

$ pulumi config set isMinikube false

として設定を変える。すると Deploy the Changes の確認が動かなくなるので NodePort で公開するように変更した。

+ port = { "port": 80, "target_port": 80, "protocol": "TCP" }
+
+ if is_minikube:
+    port.update(node_port=30000)
-        "type": "ClusterIP" if is_minikube else "LoadBalancer",
+        "type": "NodePort" if is_minikube else "LoadBalancer",
-        "ports": [{ "port": 80, "target_port": 80, "protocol": "TCP" }],
+        "ports": [port],

みたいにすれば、以下のように確認ができる。

$ curl $(minikube ip):30000
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

Workflows

Github Actions が使えるようになっていたので pull request で確認することを考える。
公式で ガイド が存在していたが、動かない点があったので変更を加える必要があった。

pip install

pip install -r requirements.txt で依存を解決する必要があったので、以下のように設定した。

      - uses: docker://pulumi/actions:v1.5.2
        with:
          entrypoint: bash
          args: -c "pip install -r quickstart/requirements.txt && /usr/bin/pulumi-action preview --non-interactive"
        env:
          PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PULUMI_CI: pr
          COMMENT_ON_PR: 1
          PULUMI_ROOT: quickstart

見た感じ npm だと entrypoint.sh で解決されるようなので、何か足りていないのかもしれない。かなり強引だが上記のようにすれば python でもとりあえずは動いた。

todo kubeconfig

kubernetes project を preview するためには kubeconfig を設定する必要があるが minikube で試したので適当なクラスタがなく todo のままになっている。

後は kubeconfig さえ設定すれば動きそうなので、確認はここまでとする。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0