Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
1bfed014
Commit
1bfed014
authored
May 01, 2017
by
Quintin Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a metadata proxy addon to gce
parent
7043372d
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
153 additions
and
1 deletion
+153
-1
OWNERS
cluster/addons/metadata-proxy/OWNERS
+8
-0
README.md
cluster/addons/metadata-proxy/README.md
+5
-0
metadata-proxy-configmap.yaml
...r/addons/metadata-proxy/gce/metadata-proxy-configmap.yaml
+60
-0
metadata-proxy.yaml
cluster/addons/metadata-proxy/gce/metadata-proxy.yaml
+52
-0
config-default.sh
cluster/gce/config-default.sh
+7
-1
config-test.sh
cluster/gce/config-test.sh
+6
-0
configure-vm.sh
cluster/gce/configure-vm.sh
+1
-0
configure-helper.sh
cluster/gce/gci/configure-helper.sh
+3
-0
init.sls
cluster/saltbase/salt/kube-addons/init.sls
+11
-0
No files found.
cluster/addons/metadata-proxy/OWNERS
0 → 100644
View file @
1bfed014
approvers:
- q-lee
- cjcullen
- mikedanese
reviewers:
- q-lee
- cjcullen
- mikedanese
cluster/addons/metadata-proxy/README.md
0 → 100644
View file @
1bfed014
# Metadata proxy
==============
This metadata proxy returns a 403 for kubelet's kube-env data, but otherwise allows
pods access to the metadata server.
cluster/addons/metadata-proxy/gce/metadata-proxy-configmap.yaml
0 → 100644
View file @
1bfed014
kind
:
ConfigMap
apiVersion
:
v1
metadata
:
name
:
metadata-proxy-config
namespace
:
kube-system
labels
:
addonmanager.kubernetes.io/mode
:
EnsureExists
data
:
nginx.conf
:
|-
user www-data;
worker_processes 4;
pid /run/nginx.pid;
error_log /dev/stdout;
events {
worker_connections 20;
}
http {
access_log /dev/stdout;
server {
listen 127.0.0.1:988;
# By default, return 403. This protects us from new API versions.
location / {
return 403;
}
# Allow for REST discovery.
location = / {
proxy_pass http://169.254.169.254;
}
location = /computeMetadata/ {
proxy_pass http://169.254.169.254;
}
# By default, allow the v0.1, v1beta1, and v1 APIs.
location /0.1/ {
proxy_pass http://169.254.169.254;
}
location /computeMetadata/v1beta1/ {
proxy_pass http://169.254.169.254;
}
location /computeMetadata/v1/ {
proxy_pass http://169.254.169.254;
}
# Return a 403 for the kube-env attribute in all allowed API versions.
location /0.1/meta-data/attributes/kube-env {
return 403;
}
location /computeMetadata/v1beta1/instance/attributes/kube-env {
return 403;
}
location /computeMetadata/v1/instance/attributes/kube-env {
return 403;
}
}
}
cluster/addons/metadata-proxy/gce/metadata-proxy.yaml
0 → 100644
View file @
1bfed014
apiVersion
:
extensions/v1beta1
kind
:
DaemonSet
metadata
:
name
:
metadata-proxy-v0.1
namespace
:
kube-system
labels
:
k8s-app
:
metadata-proxy
kubernetes.io/cluster-service
:
"
true"
addonmanager.kubernetes.io/mode
:
Reconcile
version
:
v0.1
spec
:
updateStrategy
:
type
:
RollingUpdate
template
:
metadata
:
labels
:
k8s-app
:
metadata-proxy
kubernetes.io/cluster-service
:
"
true"
version
:
v0.1
# This annotation ensures that the proxy does not get evicted if the node
# supports critical pod annotation based priority scheme.
# Note that this does not guarantee admission on the nodes (#40573).
annotations
:
scheduler.alpha.kubernetes.io/critical-pod
:
'
'
spec
:
hostNetwork
:
true
dnsPolicy
:
Default
containers
:
-
name
:
metadata-proxy
image
:
gcr.io/google-containers/metadata-proxy:0.1
imagePullPolicy
:
Always
securityContext
:
privileged
:
true
command
:
-
'
/start-proxy.sh'
resources
:
requests
:
memory
:
"
32Mi"
cpu
:
"
50m"
limits
:
memory
:
"
32Mi"
cpu
:
"
50m"
volumeMounts
:
-
name
:
config-volume
mountPath
:
/etc/nginx/
nodeSelector
:
beta.kubernetes.io/metadata-proxy-ready
:
"
true"
terminationGracePeriodSeconds
:
30
volumes
:
-
name
:
config-volume
configMap
:
name
:
metadata-proxy-config
cluster/gce/config-default.sh
View file @
1bfed014
...
@@ -129,7 +129,13 @@ NODE_LABELS="${KUBE_NODE_LABELS:-beta.kubernetes.io/fluentd-ds-ready=true}"
...
@@ -129,7 +129,13 @@ NODE_LABELS="${KUBE_NODE_LABELS:-beta.kubernetes.io/fluentd-ds-ready=true}"
# To avoid running Calico on a node that is not configured appropriately,
# To avoid running Calico on a node that is not configured appropriately,
# label each Node so that the DaemonSet can run the Pods only on ready Nodes.
# label each Node so that the DaemonSet can run the Pods only on ready Nodes.
if
[[
${
NETWORK_POLICY_PROVIDER
:-}
==
"calico"
]]
;
then
if
[[
${
NETWORK_POLICY_PROVIDER
:-}
==
"calico"
]]
;
then
NODE_LABELS
=
"
$NODE_LABELS
,projectcalico.org/ds-ready=true"
NODE_LABELS
=
"
${
NODE_LABELS
}
,projectcalico.org/ds-ready=true"
fi
# Turn the simple metadata proxy on by default.
ENABLE_METADATA_PROXY
=
"
${
ENABLE_METADATA_PROXY
:-
simple
}
"
if
[[
${
ENABLE_METADATA_PROXY
}
!=
"false"
]]
;
then
NODE_LABELS
=
"
${
NODE_LABELS
}
,beta.kubernetes.io/metadata-proxy-ready=true"
fi
fi
# Optional: Enable node logging.
# Optional: Enable node logging.
...
...
cluster/gce/config-test.sh
View file @
1bfed014
...
@@ -173,6 +173,12 @@ if [[ ${NETWORK_POLICY_PROVIDER:-} == "calico" ]]; then
...
@@ -173,6 +173,12 @@ if [[ ${NETWORK_POLICY_PROVIDER:-} == "calico" ]]; then
NODE_LABELS
=
"
$NODE_LABELS
,projectcalico.org/ds-ready=true"
NODE_LABELS
=
"
$NODE_LABELS
,projectcalico.org/ds-ready=true"
fi
fi
# Turn the simple metadata proxy on by default.
ENABLE_METADATA_PROXY
=
"
${
ENABLE_METADATA_PROXY
:-
simple
}
"
if
[[
${
ENABLE_METADATA_PROXY
}
!=
"false"
]]
;
then
NODE_LABELS
=
"
${
NODE_LABELS
}
,beta.kubernetes.io/metadata-proxy-ready=true"
fi
# Optional: Enable node logging.
# Optional: Enable node logging.
ENABLE_NODE_LOGGING
=
"
${
KUBE_ENABLE_NODE_LOGGING
:-
true
}
"
ENABLE_NODE_LOGGING
=
"
${
KUBE_ENABLE_NODE_LOGGING
:-
true
}
"
LOGGING_DESTINATION
=
"
${
KUBE_LOGGING_DESTINATION
:-
gcp
}
"
# options: elasticsearch, gcp
LOGGING_DESTINATION
=
"
${
KUBE_LOGGING_DESTINATION
:-
gcp
}
"
# options: elasticsearch, gcp
...
...
cluster/gce/configure-vm.sh
View file @
1bfed014
...
@@ -419,6 +419,7 @@ enable_cluster_ui: '$(echo "$ENABLE_CLUSTER_UI" | sed -e "s/'/''/g")'
...
@@ -419,6 +419,7 @@ enable_cluster_ui: '$(echo "$ENABLE_CLUSTER_UI" | sed -e "s/'/''/g")'
enable_node_problem_detector: '
$(
echo
"
$ENABLE_NODE_PROBLEM_DETECTOR
"
|
sed
-e
"s/'/''/g"
)
'
enable_node_problem_detector: '
$(
echo
"
$ENABLE_NODE_PROBLEM_DETECTOR
"
|
sed
-e
"s/'/''/g"
)
'
enable_l7_loadbalancing: '
$(
echo
"
$ENABLE_L7_LOADBALANCING
"
|
sed
-e
"s/'/''/g"
)
'
enable_l7_loadbalancing: '
$(
echo
"
$ENABLE_L7_LOADBALANCING
"
|
sed
-e
"s/'/''/g"
)
'
enable_node_logging: '
$(
echo
"
$ENABLE_NODE_LOGGING
"
|
sed
-e
"s/'/''/g"
)
'
enable_node_logging: '
$(
echo
"
$ENABLE_NODE_LOGGING
"
|
sed
-e
"s/'/''/g"
)
'
enable_metadata_proxy: '
$(
echo
"
$ENABLE_METADATA_PROXY
"
|
sed
-e
"s/'/''/g"
)
'
enable_rescheduler: '
$(
echo
"
$ENABLE_RESCHEDULER
"
|
sed
-e
"s/'/''/g"
)
'
enable_rescheduler: '
$(
echo
"
$ENABLE_RESCHEDULER
"
|
sed
-e
"s/'/''/g"
)
'
logging_destination: '
$(
echo
"
$LOGGING_DESTINATION
"
|
sed
-e
"s/'/''/g"
)
'
logging_destination: '
$(
echo
"
$LOGGING_DESTINATION
"
|
sed
-e
"s/'/''/g"
)
'
elasticsearch_replicas: '
$(
echo
"
$ELASTICSEARCH_LOGGING_REPLICAS
"
|
sed
-e
"s/'/''/g"
)
'
elasticsearch_replicas: '
$(
echo
"
$ELASTICSEARCH_LOGGING_REPLICAS
"
|
sed
-e
"s/'/''/g"
)
'
...
...
cluster/gce/gci/configure-helper.sh
View file @
1bfed014
...
@@ -1448,6 +1448,9 @@ function start-kube-addons {
...
@@ -1448,6 +1448,9 @@ function start-kube-addons {
if
[[
"
${
NON_MASQUERADE_CIDR
:-}
"
==
"0.0.0.0/0"
]]
;
then
if
[[
"
${
NON_MASQUERADE_CIDR
:-}
"
==
"0.0.0.0/0"
]]
;
then
setup-addon-manifests
"addons"
"ip-masq-agent"
setup-addon-manifests
"addons"
"ip-masq-agent"
fi
fi
if
[[
"
${
ENABLE_METADATA_PROXY
:-}
"
==
"simple"
]]
;
then
setup-addon-manifests
"addons"
"metadata-proxy/gce"
fi
# Place addon manager pod manifest.
# Place addon manager pod manifest.
cp
"
${
src_dir
}
/kube-addon-manager.yaml"
/etc/kubernetes/manifests
cp
"
${
src_dir
}
/kube-addon-manager.yaml"
/etc/kubernetes/manifests
...
...
cluster/saltbase/salt/kube-addons/init.sls
View file @
1bfed014
...
@@ -178,6 +178,17 @@ addon-dir-create:
...
@@ -178,6 +178,17 @@ addon-dir-create:
- file_mode: 644
- file_mode: 644
{% endif %}
{% endif %}
{% if pillar.get('enable_metadata_proxy', '').lower() == 'true' %}
/etc/kubernetes/addons/metadata-proxy/gce:
file.recurse:
- source: salt://kube-addons/metadata-proxy/gce
- include_pat: E@^.+\.yaml$
- user: root
- group: root
- dir_mode: 755
- file_mode: 644
{% endif %}
{% if pillar.get('enable_cluster_ui', '').lower() == 'true' %}
{% if pillar.get('enable_cluster_ui', '').lower() == 'true' %}
/etc/kubernetes/addons/dashboard:
/etc/kubernetes/addons/dashboard:
file.recurse:
file.recurse:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment