新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
ARG ALPINE_VERSION="3.15"
|
||||
FROM alpine:$ALPINE_VERSION
|
||||
|
||||
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing kubectl
|
||||
|
||||
COPY start.sh /
|
||||
COPY config.json /config-in/config.json
|
||||
RUN chmod +x /start.sh
|
||||
|
||||
CMD /start.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BannerMessage": "{LABEL}"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
# set up access to Kube API
|
||||
kubectl config set-cluster default --server=https://kubernetes.default.svc.cluster.local --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||
kubectl config set-context default --cluster=default
|
||||
kubectl config set-credentials user --token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
|
||||
kubectl config set-context default --user=user
|
||||
kubectl config use-context default
|
||||
|
||||
label=$(kubectl get ns kiamol-ch17 -o jsonpath='{.metadata.labels.kiamol}')
|
||||
sed -i "s/{LABEL}/$label/g" /config-in/config.json
|
||||
cp /config-in/config.json /config-out/config.json
|
||||
|
||||
echo "** Namespace label: $label. Written to config file **"
|
||||
Reference in New Issue
Block a user