| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
3,424 バイト追加 、 2021年2月16日 (火) 11:28
*https://microk8s.io/
*https://kubernetes.io/
*https://kubernetes.io/docs/tutorials/kubernetes-basics/
==基本操作==
===Document===
*[https://kubernetes.io/docs/tutorials/ チュートリアル]
*[https://kubernetes.io/docs/reference/glossary/?fundamental=true 標準用語集]
 
===インストール===
====[[Mac]]にインストール====
*https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/README.md
[https://www.typea.info/blog/index.php/2020/11/17/mac_microk8s_dashboard_etc/ ダッシュボード接続手順、トラブルシュート]
<pre>
$ microk8s enable dashboard dns
$ microk8s dashboard-proxy
</pre>
===[[Kubectl]]===
</pre>
==[https://github.com/kubernetes/examples Kubernetesサンプル]==
==Up and Deploy==
{{amazon|4873118409}}
*https://github.com/kubernetes-up-and-running/kuard
===クラスタ===
----
*https://kubernetes.io/ja/docs/tutorials/kubernetes-basics/
*Kubernetesクラスターは以下の2種類のリソースで構成
</pre>
==Up and Deploy==
{{amazon|4873118409}}
*https://github.com/kubernetes-up-and-running/kuard
===Pod===
====作成====
</pre>
====execでコマンド実行====
*[[kubectl]] -it で対話実行
<pre>
$ kubectl exec -it pod/nginx-pod -- /bin/sh
#
</pre>
 
====コンテナローカル間でファイルコピー====
*ローカル のファイルを、Podにコピー
*ストレージを管理することはインスタンスを管理することとは全くの別物
*PersistentVolumeサブシステムは、ストレージが何から提供されているか、どのように消費されているかをユーザーと管理者から抽象化するAPIを提供
*Podは、PersistentVolumeClaimを通して「こういうspecのVolumeが欲しい」と要求を出すと、その要求に一番近いPersistentVolumeがmountされるという仕組み*metadata.name、metadata.labelsと、spec.selector.matchLabels、spec.selector.matchExpressionsの値を合わせることで、PersistentVolumeとPersistentVolumeClaimのマッチングをより明示的に、期待したとおりにできる*https://thinkit.co.jp/article/14195
===PersistentVolume (PV)===
*ストレージクラスを使って管理者もしくは動的にプロビジョニングされるクラスターのストレージの一部
<pre>
$ for i in 0 1; do kubectl exec pod/web-$i hostname; done
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
web-0
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
Error from server (BadRequest): pod web-1 does not have a host assigned
An error occurred when trying to execute 'sudo microk8s.kubectl exec pod/web-1 hostname' with 'multipass': returned exit code 1.
</pre>
 
<blockquote>
永続化Volumeが、hostPath指定の場合、1つのPodからしか接続できないため立ち上がらない。
</blockquote>
<pre>
$ kubectl describe pods web-1
:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 22h (x14 over 23h) default-scheduler 0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
</pre>
===[[Ubuntu NFS構成|NFS]]の構成===
*[[Ubuntu NFS構成]]
*[https://www.server-world.info/en/note?os=Ubuntu_20.04&p=microk8s&f=5 microk8s storage class]
*[https://qiita.com/Esfahan/items/7ad7695ea78c7630239a 外部ストレージをマウント]
*[https://qiita.com/Esfahan/items/68e2d97545091cb6d0ac NFS storage class]
 
*https://thinkit.co.jp/article/14195
*https://kubernetes.io/docs/concepts/storage/volumes/
*https://github.com/kubernetes/examples/tree/master/staging/volumes/nfs
 
[https://baremetal.jp/blog/2018/04/17/541/ NFS]
 
<pre>
apiVersion: v1
kind: PersistentVolume
metadata:
name: web-pv
labels:
type: local
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteMany
storageClassName: slow
nfs:
server: 192.168.0.47
path: "/var/nfs/general"
</pre>
 
 
<pre>
$ kubectl describe pv
Name: web-pv
Labels: type=local
Annotations: &lt;none&gt;
Finalizers: [kubernetes.io/pv-protection]
StorageClass: slow
Status: Available
Claim:
Reclaim Policy: Retain
Access Modes: RWX
VolumeMode: Filesystem
Capacity: 5Gi
Node Affinity: &lt;none&gt;
Message:
Source:
Type: NFS (an NFS mount that lasts the lifetime of a pod)
Server: 192.168.0.47
Path: /var/nfs/general
ReadOnly: false
Events: &lt;none&gt;
</pre>
Each Pod https://qiita.com/silverbirder/items/d3522237b28703a9adb6<pre> Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedScheduling 2s (x6 over 5m58s) default-scheduler 0/1 nodes are available: 1 pod has a stable hostname based on its ordinal indexunbound immediate PersistentVolumeClaims. Use kubectl exec to execute the hostname command in each Pod:TODO</pre>
==デプロイ==

案内メニュー