<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>serverless  |  そーたの技術ブログ</title>
	<atom:link href="https://blog.so-ta.net/category/serverless/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.so-ta.net/</link>
	<description>ハマったことをまとめる</description>
	<lastBuildDate>Tue, 03 Dec 2019 11:11:09 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.7</generator>

<image>
	<url>https://blog.so-ta.net/wp/wp-content/uploads/2019/08/cropped-face3-32x32.png</url>
	<title>serverless  |  そーたの技術ブログ</title>
	<link>https://blog.so-ta.net/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>ローカルでサーバレス環境を構築する(Knative)</title>
		<link>https://blog.so-ta.net/serverless/knative-local/</link>
					<comments>https://blog.so-ta.net/serverless/knative-local/#respond</comments>
		
		<dc:creator><![CDATA[渡辺爽太]]></dc:creator>
		<pubDate>Sat, 28 Sep 2019 12:22:17 +0000</pubDate>
				<category><![CDATA[serverless]]></category>
		<guid isPermaLink="false">https://blog.so-ta.net/?p=161</guid>

					<description><![CDATA[はじめに この記事は ローカルでkubernetes環境を構築する(kubeadm)でkubernetes環境(以下、k8s) を作成した人向けです。 開発環境 Ubuntu 18.04 手順 まず、コントロールプレーン [&#8230;]]]></description>
										<content:encoded><![CDATA[<h2>はじめに</h2>
<p>この記事は<a target="_blank" href="https://blog.so-ta.net/serverless/kubernetes/kubeadm-local/" title="オンプレでkubernetes環境を構築する(kubeadm)"> ローカルでkubernetes環境を構築する(kubeadm)<span class="fa fa-external-link internal-icon anchor-icon"></span></a>でkubernetes環境(以下、k8s) を作成した人向けです。</p>
<h2>開発環境</h2>
<p>Ubuntu 18.04</p>
<h2>手順</h2>
<p>まず、コントロールプレーンノードでポッドをスケジュールするため以下を実行します。</p>
<pre><code>kubectl taint nodes --all node-role.kubernetes.io/master-</code></pre>
<p>この作業がないとhelmのtiller pod がpendingのまま動きません。<br />
次にhelmをインストールし、初期化します。</p>
<pre><code>sudo snap install helm --classic
helm init --history-max 200</code></pre>
<p>tiller pod が作成されたはずなので見てみます。</p>
<p>追記:<br />
helmが更新されたため、この方法だと以下の作業ができなくなりました。最新バージョンではなく以下の方法でインストールしてください。<br />
<code>snap install --channel=2.16 helm --classic</code></p>
<pre><code>kubectl get po -n kube-system</code></pre>
<p>tiller-deploy-〜のpodがあれば正常です。pod の状態はPending -&gt; ContainerCreating -&gt; RunningとなるのでRunningするまで待ちます。</p>
<p>次にistioをインストールします。istioとはマイクロサービスを管理するOSSです。</p>
<pre><code>export ISTIO_VERSION=1.1.7
curl -L https://git.io/getLatestIstio | sh -
cd istio-${ISTIO_VERSION}
for i in install/kubernetes/helm/istio-init/files/crd*yaml; do kubectl apply -f $i; done

cat &lt;&lt;EOF | kubectl apply -f -
   apiVersion: v1
   kind: Namespace
   metadata:
     name: istio-system
     labels:
       istio-injection: disabled
EOF

# A lighter template, with just pilot/gateway.
# Based on install/kubernetes/helm/istio/values-istio-minimal.yaml
helm template --namespace=istio-system \
  --set prometheus.enabled=false \
  --set mixer.enabled=false \
  --set mixer.policy.enabled=false \
  --set mixer.telemetry.enabled=false \
  `# Pilot does not need a sidecar.`\
  --set pilot.sidecar=false \
  --set pilot.resources.requests.memory=128Mi \
  `# Disable galley (and things requiring galley).` \
  --set galley.enabled=false \
  --set global.useMCP=false \
  `# Disable security / policy.` \
  --set security.enabled=false \
  --set global.disablePolicyChecks=true \
  `# Disable sidecar injection.` \
  --set sidecarInjectorWebhook.enabled=false \
  --set global.proxy.autoInject=disabled \
  --set global.omitSidecarInjectorConfigMap=true \
  `# Set gateway pods to 1 to sidestep eventual consistency / readiness problems.` \
  --set gateways.istio-ingressgateway.autoscaleMin=1 \
  --set gateways.istio-ingressgateway.autoscaleMax=1 \
  `# Set pilot trace sampling to 100%` \
  --set pilot.traceSampling=100 \
  install/kubernetes/helm/istio \
  &gt; ./istio-lean.yaml

kubectl apply -f istio-lean.yaml

# from https://github.com/helm/helm/issues/4181
kubectl taint nodes --all node-role.kubernetes.io/master-

# Add the extra gateway.
helm template --namespace=istio-system \
  --set gateways.custom-gateway.autoscaleMin=1 \
  --set gateways.custom-gateway.autoscaleMax=1 \
  --set gateways.custom-gateway.cpu.targetAverageUtilization=60 \
  --set gateways.custom-gateway.labels.app=&#039;cluster-local-gateway&#039; \
  --set gateways.custom-gateway.labels.istio=&#039;cluster-local-gateway&#039; \
  --set gateways.custom-gateway.type=&#039;ClusterIP&#039; \
  --set gateways.istio-ingressgateway.enabled=false \
  --set gateways.istio-egressgateway.enabled=false \
  --set gateways.istio-ilbgateway.enabled=false \
  install/kubernetes/helm/istio \
  -f install/kubernetes/helm/istio/example-values/values-istio-gateways.yaml \
  | sed -e &quot;s/custom-gateway/cluster-local-gateway/g&quot; -e &quot;s/customgateway/clusterlocalgateway/g&quot; \
  &gt; ./istio-local-gateway.yaml

kubectl apply -f istio-local-gateway.yaml</code></pre>
<p>Knativeをインストールします。</p>
<pre><code>kubectl apply --selector knative.dev/crd-install=true \
   --filename https://github.com/knative/serving/releases/download/v0.9.0/serving.yaml \
   --filename https://github.com/knative/eventing/releases/download/v0.9.0/release.yaml \
   --filename https://github.com/knative/serving/releases/download/v0.9.0/monitoring.yaml

kubectl apply --filename https://github.com/knative/serving/releases/download/v0.9.0/serving.yaml \
   --filename https://github.com/knative/eventing/releases/download/v0.9.0/release.yaml \
   --filename https://github.com/knative/serving/releases/download/v0.9.0/monitoring.yaml</code></pre>
<p>すべてのpodがRunningしたら完了です。<br />
以下のコマンドで確認してください。</p>
<pre><code>kubectl get po -A</code></pre>
<p>お疲れ様でした。</p>
<h2>参考文献</h2>
<a rel="noopener" target="_blank" href="https://github.com/helm/helm/issues/4181" title="kube-system tiller-deploy-f9b8476d-zkln4 always pending by failed scheduling · Issue #4181 · helm/helm" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img src="https://opengraph.githubassets.com/b2a93fd5e77b3abb4bca88ac9e3dc43e4f5fb261e01dc3a2be85fdb8752839cd/helm/helm/issues/4181" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">kube-system tiller-deploy-f9b8476d-zkln4 always pending by failed scheduling · Issue #4181 · helm/helm</div><div class="blogcard-snippet external-blogcard-snippet">how to fix this? Output of helm version: Client: &amp;version.Version{SemVer:&quot;v2.9.1&quot;, GitCommit:&quot;20adb27c7c5868466912eebdf6664e7390ebe710&quot;,...</div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img src="https://www.google.com/s2/favicons?domain=github.com" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">github.com</div></div></div></div></a>
<a rel="noopener" target="_blank" href="https://knative.dev/docs/install/knative-with-any-k8s/" title="https://knative.dev/docs/install/knative-with-any-k8s/" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img src="https://s0.wordpress.com/mshots/v1/https%3A%2F%2Fknative.dev%2Fdocs%2Finstall%2Fknative-with-any-k8s%2F?w=160&#038;h=90" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">https://knative.dev/docs/install/knative-with-any-k8s/</div><div class="blogcard-snippet external-blogcard-snippet"></div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img src="https://www.google.com/s2/favicons?domain=knative.dev" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">knative.dev</div></div></div></div></a>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.so-ta.net/serverless/knative-local/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
