Cluster API によるKubernetes環境のライフサイクル管理とマルチクラウド環境での適用Motonori Shindo
Cluster API は Kubernetes の宣言的APIとリソースの管理機能を活かし、Kubernetes環境のライフサイクル管理を行うもので、Kubernetesコミュニティで仕様の策定と開発が進められています。
これまでもKubernetes環境の構築を支援するツールはいくつかありましたが、Cluster APIはコミュニティからの大きな支持を得ており、Cluster APIのエコシステムが広がりつつあります。
本セッションでは Cluster API の概要と最新の動向、また、Cluster APIを利用した大規模マルチクラウド環境への適用などをデモを交えながら解説を行います。
本資料はCloud Operator Days Tokyo 2020登壇時の資料です。
"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発Yahoo!デベロッパーネットワーク
This document discusses automating Kubernetes deployments using Kubernetes-as-a-Service. It defines a CustomResourceDefinition for Kubernetes clusters that includes specifications for the Kubernetes version, number of master and worker nodes, and hardware flavors. It also includes an example KubernetesCluster resource definition.
Cluster API によるKubernetes環境のライフサイクル管理とマルチクラウド環境での適用Motonori Shindo
Cluster API は Kubernetes の宣言的APIとリソースの管理機能を活かし、Kubernetes環境のライフサイクル管理を行うもので、Kubernetesコミュニティで仕様の策定と開発が進められています。
これまでもKubernetes環境の構築を支援するツールはいくつかありましたが、Cluster APIはコミュニティからの大きな支持を得ており、Cluster APIのエコシステムが広がりつつあります。
本セッションでは Cluster API の概要と最新の動向、また、Cluster APIを利用した大規模マルチクラウド環境への適用などをデモを交えながら解説を行います。
本資料はCloud Operator Days Tokyo 2020登壇時の資料です。
"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発Yahoo!デベロッパーネットワーク
This document discusses automating Kubernetes deployments using Kubernetes-as-a-Service. It defines a CustomResourceDefinition for Kubernetes clusters that includes specifications for the Kubernetes version, number of master and worker nodes, and hardware flavors. It also includes an example KubernetesCluster resource definition.
Red Hat Enterprise Linux 7 上でのDockerのステータス、使い方の解説と、Project Atomicをはじめとして、CentOS Atomic Host, RHEL Atomic Hostの解説。CentOS Atomic HostでKubernetesを使うチュートリアル。
Introducton to Convolutional Nerural Network with TensorFlowEtsuji Nakai
Explaining basic mechanism of the Convolutional Neural Network with sample TesnsorFlow codes.
Sample codes: https://github.com/enakai00/cnn_introduction
Machine Learning Basics for Web Application DevelopersEtsuji Nakai
This document provides an overview of machine learning basics for web application developers. It discusses linear binary classifiers and logistic regression, how to measure model fitness with loss functions, and graphical understandings of linear classifiers. It then covers linear multiclass classifiers using softmax functions, image classification with neural networks, and ways to improve accuracy using convolutional neural networks. Finally, it discusses client applications that use pre-trained machine learning models through API services and examples of smile detection and cucumber classification.
Your first TensorFlow programming with JupyterEtsuji Nakai
This document provides an introduction and overview of TensorFlow and how to use it with Jupyter notebooks on Google Cloud Platform (GCP). It explains that TensorFlow is Google's open source library for machine learning and was launched in 2015. It is used for many production machine learning projects. Jupyter is introduced as an interactive web-based platform for data analysis that can also be used as a TensorFlow runtime environment. The document then provides details on the programming paradigm and model of TensorFlow, giving an example of using it for a least squares method problem to predict temperatures. It explains the key components of defining a model, loss function, and training algorithm to optimize variables in a session.
This document provides an introduction to deep Q-networks (DQN) for beginners. It explains that DQNs can be used to learn optimal actions in video games by collecting data on screen states, player actions, rewards, and next states without knowing the game's rules. The key idea is to approximate a "Q function" that represents the total expected rewards if optimal actions are taken from each state onward. A deep neural network is used as the candidate function, and its parameters are adjusted using an error function to satisfy the Q-learning equation. To collect the necessary state-action data, the game is played with a mix of random exploration and exploiting the current best actions from the Q-network.
32. 32
Docker with RHEL7 技術勉強会
dm-thinのスナップショット機能について
Dockerは、Dockerイメージのスナップショットコピーを多用します(次ページ参照)が、
RHEL7/CentOS7/Atomic HostのDockerでは、dm-thinのスナップショット機能を用いて、
コピーを作成します。
– 差分領域のみに新しいブロックが割り当てるため高速にコピーを取得すると共に、ディスク使用量を
節約する効果があります。
A B C
スナップショット作成直後
A B C A B C
ブロックプール
・・・ A B C D
A B C A B D
書き込み発生
・・・
ブロックプール
書き込んだ部分は
新しいブロックを割り当てる
46. 46
Docker with RHEL7 技術勉強会
PostgreSQL用イメージのサンプル
FROM enakai00/rhel6:ver1.0
MAINTAINER Etsuji Nakai
RUN groupadd -g 10000 postgres;
useradd -u 10000 -g 10000 postgres
RUN yum -y install postgresql-server
ADD init.sh /usr/local/bin/init.sh
RUN chown postgres.postgres /usr/local/bin/init.sh;
chmod u+x /usr/local/bin/init.sh
USER postgres
EXPOSE 5432
CMD ["/usr/local/bin/init.sh"]
~/build_pgsql/Dockerfile
ユーザー「postgres」で
起動スクリプト init.sh を実行
uid/gidを明示して
ユーザー/グループを作成
47. 47
Docker with RHEL7 技術勉強会
PostgreSQL用イメージのサンプル
#!/bin/bash
export PGDATA=/var/lib/pgsql/data
if [ "${PG_USER-undef}" = "undef" ]; then
export PG_USER=pguser
fi
if [ "${PG_DATABASE-undef}" = "undef" ]; then
export PG_DATABASE=pgdb
fi
if [[ ! -f /var/lib/pgsql/data/PG_VERSION ]]; then
/usr/bin/initdb
cat <<'EOF' >> /var/lib/pgsql/data/postgresql.conf
listen_addresses = '*'
log_destination = 'stderr'
logging_collector = off
EOF
cat <<'EOF' > /var/lib/pgsql/data/pg_hba.conf
local all all trust
host all all 0.0.0.0/0 trust
host all all ::1/128 trust
EOF
/usr/bin/pg_ctl start
sleep 5
/usr/bin/createuser -D -E -R -S -U postgres $PG_USER
/usr/bin/createdb -O $PG_USER $PG_DATABASE
/usr/bin/pg_ctl stop
fi
exec /usr/bin/postmaster
~/build_pgsql/init.sh
環境変数を用いて、作成する
ユーザーとDBを指定
execコマンドで自分自身(PID=1)を
アプリケーションプロセスに切り替える
あくまでサンプルなので
セキュリティ設定は適当です…
「docker logs」でログが見れるように
標準(エラー)出力にログを出力
48. 48
Docker with RHEL7 技術勉強会
PostgreSQL用イメージのサンプル
ビルド/実行例は次のようになります。
# docker build -t enakai00/pgsql:ver1.0 ~/build_pgsql/
# mkdir /data
# chcon -Rt svirt_sandbox_file_t /data
# chown 10000.10000 /data
# docker run -itd -p 5432:5432 -v /data:/var/lib/pgsql/data --name pgsql
-e PG_USER=etsuji -e PG_DATABASE=mydb enakai00/pgsql:ver1.0
# docker logs pgsql
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
...
LOG: database system was shut down at 2016-02-09 04:10:27 EST
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
# psql -h localhost -U etsuji -l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+-----------+---------+-------+-----------------------
mydb | etsuji | SQL_ASCII | C | C |
postgres | postgres | SQL_ASCII | C | C |
template0 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
データ保存ディレクトリーは
ホストLinux上に用意
49. 49
Docker with RHEL7 技術勉強会
PostgreSQL用イメージのサンプル
コンテナを停止すると、DBの停止処理が適切に行われていることがわかります。
# docker stop pgsql
# docker logs pgsql
...
waiting for server to shut down....LOG: received smart shutdown request
LOG: autovacuum launcher shutting down
LOG: shutting down
LOG: database system is shut down
done
server stopped
LOG: database system was shut down at 2016-02-09 04:21:19 EST
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
LOG: received smart shutdown request
LOG: autovacuum launcher shutting down
LOG: shutting down
LOG: database system is shut down
# docker rm pgsql