Help us understand the problem. What is going on with this article?

gcloudとkubectl入りのDockerイメージを作る

More than 1 year has passed since last update.

なにこれ

GKEでPersistentVolumeClaimで確保したディスクのバックアップを取るために、gcloudコマンドと、kubectlコマンドの入ったDockerイメージが必要になって、作ってみたのでメモ。

gcloud components install kubectlだと、容量がたくさん必要になったので、別の方法を考えた。

できたもの

FROM google/cloud-sdk:226.0.0-alpine

RUN apk --no-cache upgrade && \
    apk --no-cache add ca-certificates && \
    curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
    chmod +x ./kubectl && \
    mv ./kubectl /usr/local/bin/kubectl

やってること自体単純で、Google公式リポジトリにあるAlpine版のcloud-sdkのイメージをベースに、kubectlのバイナリを落としてきて、実行可能にしているだけ。

単純に gcloud components install kubectl だと、200MBぐらい増えちゃったのが、この方法だと50MBぐらいの増加。

もしかしたら、gcloudの方も、本当に必要なコマンドだけに絞ればもっと容量が削れるのかも。

ちなみに、バックアップの方は、うまくいきました。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away