Merge pull request #1106 from aaron-prindle/update-localkube-docker

Updated localkube docker instructions, added build to main makefile
pull/1149/head
Aaron Prindle 2017-02-17 15:39:28 -08:00 committed by GitHub
commit bb4b7ceb95
5 changed files with 27 additions and 69 deletions

View File

@ -20,6 +20,7 @@ VERSION ?= v$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD)
DEB_VERSION ?= $(VERSION_MAJOR).$(VERSION_MINOR)-$(VERSION_BUILD)
INSTALL_SIZE ?= $(shell du out/minikube-windows-amd64.exe | cut -f1)
BUILDROOT_BRANCH ?= 2016.08
REGISTRY?=gcr.io/k8s-minikube
ISO_VERSION ?= v1.0.6
ISO_BUCKET ?= minikube/iso
@ -47,6 +48,7 @@ BUILD_OS := $(shell uname -s)
LOCALKUBE_VERSION := $(shell $(PYTHON) hack/get_k8s_version.py --k8s-version-only 2>&1)
LOCALKUBE_BUCKET := gs://minikube/k8sReleases
TAG ?= $(LOCALKUBE_VERSION)
# Set the version information for the Kubernetes servers, and build localkube statically
K8S_VERSION_LDFLAGS := $(shell $(PYTHON) hack/get_k8s_version.py 2>&1)
@ -173,8 +175,14 @@ release-localkube: out/localkube checksum
update-releases:
gsutil cp deploy/minikube/k8s_releases.json gs://minikube/k8s_releases.json
out/localkube-image: out/localkube
# TODO(aprindle) make addons placed into container configurable
docker build -t $(REGISTRY)/localkube-image:$(TAG) -f deploy/docker/Dockerfile .
@echo ""
@echo "${REGISTRY}/localkube-image:$(TAG) succesfully built"
@echo "See https://github.com/kubernetes/minikube/tree/master/deploy/docker for instrucions on how to run image"
.PHONY: release-iso
release-iso: minikube_iso checksum
gsutil cp out/minikube.iso gs://$(ISO_BUCKET)/minikube-$(ISO_VERSION).iso
gsutil cp out/minikube.iso.sha256 gs://$(ISO_BUCKET)/minikube-$(ISO_VERSION).iso.sha256

View File

@ -27,6 +27,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Copy over important files
COPY localkube /
COPY static-pods /etc/kubernetes/manifests
COPY addons /etc/kubernetes/addons
COPY out/localkube /
COPY out/deploy/addons/addon-manager.yaml /etc/kubernetes/manifests/addon-manager.yaml
COPY out/deploy/addons /etc/kubernetes/addons

View File

@ -1,31 +0,0 @@
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
REGISTRY?=gcr.io/google_containers
ARCH?=amd64
TEMP_DIR:=$(shell mktemp -d)
all: build
build:
ifndef VERSION
$(error VERSION is undefined)
endif
cp -r ./* $(TEMP_DIR)
cp -r ../addons ./static-pods $(TEMP_DIR)
cp ../../out/localkube $(TEMP_DIR)
chmod +x $(TEMP_DIR)/localkube
docker build -t $(REGISTRY)/localkube-$(ARCH):$(VERSION) $(TEMP_DIR)

View File

@ -1,11 +1,11 @@
### Run localkube in a docker container (experimental)
**Warning:** This is very experimental code at the moment.
**Warning:** This is experimental code at the moment.
#### How to build
From root minikube/ directory run:
```console
$ make VERSION=vX.Y.Z
$ make localkube-image #optional env-vars: TAG=LOCALKUBE_VERSION REGISTRY=gcr.io/k8s-minikube
```
#### How to run
@ -20,7 +20,17 @@ $ docker run -d \
--net=host \
--pid=host \
--privileged \
gcr.io/google_containers/localkube-amd64:vX.Y.Z \
gcr.io/k8s-minikube/localkube-amd64:LOCALKUBE_VERSION \
/localkube start \
--apiserver-insecure-address=0.0.0.0 \
--apiserver-insecure-port=8080 \
--logtostderr=true \
--containerized
```
Then to setup `kubectl` to use this cluster:
```console
kubectl config set-cluster localkube-image --server=http://127.0.0.1:8080 --api-version=v1
kubectl config set-context localkube-image --cluster=localkube-image
kubectl config use-context localkube-image
```
Now `kubectl` should be configured to properly access your local k8s environment

View File

@ -1,29 +0,0 @@
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v1
kind: Pod
metadata:
name: kube-addon-manager
namespace: kube-system
version: v2
spec:
hostNetwork: true
containers:
- name: kube-addon-manager
image: gcr.io/google-containers/kube-addon-manager-amd64:v2
resources:
requests:
cpu: 5m
memory: 50Mi