0. 背景 以前KubernetesのKubectlを代替するツールであるkuiを触ってみた。 その関連ツールであるDashboardも触ってみたいと思ったので、本記事にまとめる。
1. 動作環境 M1 Macbook AirのDocker Desktop 2. Dashboardをデプロイする 早速使ってみる
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.5/aio/deploy/recommended.yamlku Podが二つ起動している >> kubectl get po -n kubernetes-dashboard 03/01 8:09:48 <0> NAME READY STATUS RESTARTS AGE dashboard-metrics-scraper-856586f554-rklvj 1/1 Running 0 44s kubernetes-dashboard-7979bc45d5-tx7hb 1/1 Running 0 44s 3.Dashboardアクセス用のService Accountの作成 Serivce account用のyamlを作成する
>> cat temp.yaml 03/01 8:38:37 <0> apiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kubernetes-dashboard --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: admin-user roleRef: apiGroup: rbac....
1. 動作環境 MacBook Air (M1, 2020) Homebrew 3.4.0 Docker Desktop Version 4.5.0 2. 「kui」とは GUIでkubectlと同等の操作をできるツール。 kubernetesのGUIとしてはdashboardがあるが、これは既存のリソースなどを確認するためのもので、kubectlによる操作を代替するものではない。 今回はkuiを使ってみて操作性などを確認してみる。
3. インストール方法 Macならbrewでインストール可能。
brew install --cask kui 4. 利用方法 kubectl kui get po GUIを起動することが出来る。
5. 触ってみる 今回はNamespaceに限定してどのような操作が可能か確認する
kubeconfigのコンテキスト、namespace、kuiのGUIの表示を左下のボタンから変更できる リソースを表示してみる(namespace) それぞれのnamespaceに関して詳細を表示できる 画面下部にはOSのshellもある 6. 参考サイト https://kui.tools/
背景 webhookなどの自作スクリプトの動作確認などをする際に、 httpリクエストの対応相手側が受け取った情報を確認できるようにしたい
動作要件 python3/flask (動作確認は、Python 3.7.3@Macbookpro2019で行った)
事前準備 $ pip3 install Flask $ python3 -m pip install Flask スクリプト from flask import Flask, request app = Flask(__name__) @app.route("/", methods=['POST']) def webhook(): headers = request.headers print(headers) body = request.get_data().decode('utf-8') + '\n' print(body) return body if __name__ == "__main__": app.run() 起動方法 スクリプトを実行するのみ。終了はCtrl+C ※環境に依っては、pythonの部分がpython3だったりpytohn3.xだったりします。
$ python test.py * Serving Flask app "test" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment....
Oh My Bashとは 1. 動作環境 bash -c "$(curl -fsSL https://raw.github.com/ohmybash/oh-my-bash/master/tools/install.sh)" . 最後に . 参考にしたサイト https://terminalroot.com/discover-and-install-oh-my-bash/ https://www.lisz-works.com/entry/xubuntu-ssh-load-failed-bashrc
0. 前提 Kubernetes, GitLabに関する基礎的な知識があるとなお良いです 1. 動作環境 EKS v1.19.15-eks-9c63c4 kubectl v1.23.3 helm v3.8.0 SaaS のGitLabを利用 2. Runner用のnamespaceを作成する(省略可) kubectl create namespace gitlab 3. Runner用のhelmリポジトリを追加する helm repo add gitlab https://charts.gitlab.io helm repo list 4. values.yamlに設定を投入する 現在のvalues.yamlを取得する helm inspect values gitlab/gitlab-runner > values.yaml GitLabのURLを設定する gitlabUrlの値を設定する
Runner登録用のトークンを設定する runnerRegistrationTokenの値を編集する
RBACの作成を有効化する rbac.createdの値を設定する rbac: created: true 5. Helmをインストールする helm install -n gitlab gitlab-runner -f values.yaml gitlab/gitlab-runner helm list -n gitlab kubectl get all -n gitlab 6....
はじめに OpenShiftの勉強をするにあたり、CodeReady Container環境を使ってKubernetes公式チュートリアルを一通りやってみる。
学習内容 公式チュートリアルでは、Deploymentの作成、状態確認、外部公開、スケールアウト、アップデート、ロールバックを行う。 https://kubernetes.io/ja/docs/tutorials/kubernetes-basics/
環境 以下で作成したCodeReady Container環境を使用 https://kurikube.github.io/post/20210131/
Module 1 - Create a Kubernetes cluster Cluster details この章ではクラスターの起動と状態確認を行う。
クラスターの起動と状態確認 Code Ready Containerのバージョンを確認する。
[centos@ip-172-31-19-74 ~]$ crc version WARN A new version (1.39.0) has been published on https://developers.redhat.com/content-gateway/file/pub/openshift-v4/clients/crc/1.39.0/crc-linux-amd64.tar.xz CodeReady Containers version: 1.38.0+659b2cbd OpenShift version: 4.9.12 (embedded in executable) OpenShift APIを実行するコマンドラインツールocのバージョンとマスターノードのバージョンを確認する。
[centos@ip-172-31-19-74 ~]$ oc version Client Version: 4.9.12 Kubernetes Version: v1.22.3+e790d7f クラスターの詳細確認 クラスターの詳細情報を取得する。
[centos@ip-172-31-19-74 ~]$ oc cluster-info Kubernetes control plane is running at https://api....
0. 前提 1. 動作環境 . 最後に . 参考にしたサイト https://qiita.com/iqustechtips/items/ebf66e5f243efd93b399 https://al-batross.net/2021/04/06/openfaas-deploy-on-kubernetes/
0. 前提 kubernetes, Operatorに関する初歩的な知識があるとなお良い 1. 動作環境 EC2 (t3.2xlarge) Ubuntu 20.04.2 LTS Docker 20.10.7 go 1.17.6 2. Dockerでjaegerをインストールする Jaegerインストール済みのDockerコンテナを起動する docker run -d --name=jaeger -p 5775:5775/udp -p 16686:16686 jaegertracing/all-in-one:latest http://localhost:16686 でUIにアクセス可能です。
3. GoでJaegerにTrace情報を連携する Trace情報を渡すプログラムをGoで実装してみます。
ライブラリをインストールする go get github.com/uber/jaeger-client-go go get github.com/opentracing/opentracing-go go get github.com/pkg/errors Goのブログラムを実装する trace_sampleという名前のTracerを作成し、そのTracerの中にhelloとworldの2種類のspanが流れるサンプルコードになっています。 package main import ( "fmt" "github.com/opentracing/opentracing-go" "github.com/uber/jaeger-client-go" "github.com/uber/jaeger-client-go/config" "time" ) func main() { cfg := config.Configuration{ Sampler: &config....
0.前提 kubernetes, helmに関する初歩的な知識 1.動作環境 EC2 (t3.xlarge) Ubuntu 20.04.03 LTS kind version 0.11.1 Docker 20.10.7 helm v3.8.0 go 1.17 2. KEDAをHelmでインストールする https://keda.sh/docs/2.5/deploy/ を参考に、インストールする 2.1 Helm リポジトリを追加する ubuntu@ip-172-31-27-87:~$ helm repo add kedacore https://kedacore.github.io/charts "kedacore" has been added to your repositories 2.2 Helmのリポジトリをアップデートする ubuntu@ip-172-31-27-87:~$ helm repo update Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the "kedacore" chart repository Update Complete....
0. 前提 kubernetes, Dockerに関する基礎知識 1. 動作環境 EC2(t3.xlarge) (※補足 t3.largeだとcpu不足で動作しませんでした。) Ubuntu NAME="Ubuntu" VERSION="20.04.3 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.3 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal kind version 0.11.1 knative-serving v0.29.0 kn-quickstart Version: v1.2.0 Docker 20.10.7 npm v6.14.4 2. 試してみる 2.1 kind, kubectlのインストール kindのインストール https://kind.sigs.k8s.io/docs/user/quick-start/ を参考にインストールする
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64 chmod +x ./kind mv ./kind /usr/local/bin/kind kubectlのインストール https://kubernetes.io/ja/docs/tasks/tools/install-kubectl/ を参考にインストール sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2 curl -s https://packages....